Click here to Skip to main content
15,880,651 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Convert curl request Pin
k50544-Jul-22 6:17
mvek50544-Jul-22 6:17 
GeneralRe: Convert curl request Pin
_Flaviu4-Jul-22 7:10
_Flaviu4-Jul-22 7:10 
GeneralRe: Convert curl request Pin
k50544-Jul-22 7:17
mvek50544-Jul-22 7:17 
GeneralRe: Convert curl request Pin
_Flaviu4-Jul-22 7:31
_Flaviu4-Jul-22 7:31 
GeneralRe: Convert curl request Pin
Richard MacCutchan4-Jul-22 9:21
mveRichard MacCutchan4-Jul-22 9:21 
GeneralRe: Convert curl request Pin
_Flaviu4-Jul-22 19:48
_Flaviu4-Jul-22 19:48 
GeneralRe: Convert curl request Pin
k50544-Jul-22 9:26
mvek50544-Jul-22 9:26 
QuestionAmazing C/C++ and C# and Python performance test Pin
Code4Ever2-Jul-22 6:48
Code4Ever2-Jul-22 6:48 
I tried to do a basic calculation for testing the performance of different programming languages:

C/C++: (***3.05 s***)

int main()
{
	int start = clock();
	double result;
	//<...>
	for (size_t i = 1; i < 100000000; i++)
	{
		result = sin((i * 25) / i * i);
	}
	//<...>
	int end = clock();//Now check what amount of ticks we have now. 
	//To get the time, just subtract start from end, and divide by CLOCKS_PER_SEC.
	std::cout << "it took " << end - start << "ticks std::endl;
}


C#: (***2.452 s***)
using System.Diagnostics;

class TestClass
{
    static void Main(string[] args)
    {
        Stopwatch sw = new Stopwatch();
        double result;

        sw.Start();
        {
            for (int i = 1; i < 100000000; i++)
            {
                result = Math.Sin((i * 25)/i * i);
            }
        }
        sw.Stop();
        Console.WriteLine(sw.ElapsedMilliseconds.ToString());
    }
}


And the same calculation in Python took 22.14 s to complete

Why is C# faster than C++?Confused | :confused: Confused | :confused: Confused | :confused:
AnswerRe: Amazing C/C++ and C# and Python performance test Pin
Gerry Schmitz2-Jul-22 7:02
mveGerry Schmitz2-Jul-22 7:02 
AnswerRe: Amazing C/C++ and C# and Python performance test PinPopular
harold aptroot2-Jul-22 7:38
harold aptroot2-Jul-22 7:38 
AnswerRe: Amazing C/C++ and C# and Python performance test Pin
CPallini2-Jul-22 11:07
mveCPallini2-Jul-22 11:07 
Questionimage background datagrid Pin
ousaokn30-Jun-22 19:26
ousaokn30-Jun-22 19:26 
AnswerRe: image background datagrid Pin
Victor Nijegorodov30-Jun-22 20:11
Victor Nijegorodov30-Jun-22 20:11 
AnswerRe: image background datagrid Pin
Gerry Schmitz1-Jul-22 4:21
mveGerry Schmitz1-Jul-22 4:21 
QuestionFile IO library Pin
Calin Negru26-Jun-22 3:45
Calin Negru26-Jun-22 3:45 
AnswerRe: File IO library Pin
Greg Utas26-Jun-22 4:21
professionalGreg Utas26-Jun-22 4:21 
GeneralRe: File IO library Pin
Calin Negru26-Jun-22 11:17
Calin Negru26-Jun-22 11:17 
AnswerRe: File IO library Pin
k505426-Jun-22 4:21
mvek505426-Jun-22 4:21 
AnswerRe: File IO library Pin
Richard MacCutchan26-Jun-22 4:49
mveRichard MacCutchan26-Jun-22 4:49 
Questionhello guy my name is SARORN can i ask you about any inform? Pin
Sa Ron 202224-Jun-22 5:40
Sa Ron 202224-Jun-22 5:40 
AnswerRe: hello guy my name is SARORN can i ask you about any inform? Pin
Victor Nijegorodov24-Jun-22 5:51
Victor Nijegorodov24-Jun-22 5:51 
AnswerRe: hello guy my name is SARORN can i ask you about any inform? Pin
k505424-Jun-22 6:27
mvek505424-Jun-22 6:27 
AnswerRe: hello guy my name is SARORN can i ask you about any inform? Pin
RedDk24-Jun-22 8:42
RedDk24-Jun-22 8:42 
Questionc++ Pin
tuanguyen200021-Jun-22 22:59
tuanguyen200021-Jun-22 22:59 
QuestionRe: c++ Pin
CPallini22-Jun-22 0:02
mveCPallini22-Jun-22 0:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.