Const STD: : size_t MAX_LEN=10000;
STD: : listStdList;
Auto startTime=STD: : chrono: : system_clock: : now ();
For (STD: : size_t I=0; iStdList. Push_back (I);
Auto endTime=STD: : chrono: : system_clock: : now ();
STD: : cout<& lt;" Spend time: "& lt; <(endTime - startTime). The count () & lt;
A 64 - bit win10 system
Using vs2019 compilation, 64 release version, run twice, the results for the
Time: 1173258
Time: 1250203
64 for the debug version, run two results for
Time: 2366843
Time: 2437730
Then I use 64 MingW compiler running under the
G + +. The main CPP -o test
G + + version of them 7.3.0
Then run the results a
2Time: 173692500
Time: 170578100
I want to ask next same list, why Microsoft's list two orders of magnitude faster than the gnu list? The gap is too big, too
CodePudding user response:
Are open to the optimal compilation?CodePudding user response:
Hardware is the sameCodePudding user response:
G + + O3 -CodePudding user response:
And I'm not sure the output of the clock is not consistent, you can use the below duration_cast conversionCodePudding user response:
Clock unit is different? One is a millisecond, another is different,To be divided by
CLOCKS_PER_SECOND
CodePudding user response:
You this is the feeling of release and debug contrast, such as 3 floor, O2 and O3 or - give it a tryCodePudding user response: