Home > Back-end >  Why Microsoft's list and list of GCC difference so much?
Why Microsoft's list and list of GCC difference so much?

Time:10-28

 
Const STD: : size_t MAX_LEN=10000;
STD: : list StdList;

Auto startTime=STD: : chrono: : system_clock: : now ();
For (STD: : size_t I=0; i StdList. 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 same

CodePudding 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 conversion

CodePudding 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 try

CodePudding user response:

refer to the second floor qq_40162781 response:
with the same hardware?

Really on the same computer, the same code files, just using a different compiler



refer to 6th floor ztenv response:
you this is the feeling of release and debug contrast, such as 3 floor, O2 and O3 or - try

I changed my own desktop, tested code, g + + compiler version or 7.3.0, time is
1002100
If compilation command - O3 is
997500

The same computer, use vs2019 compiled 64 release version, the value of
4746


CodePudding user response:

refer to 7th floor and shield the baron's reply:
Quote: refer to the second floor qq_40162781 response:
with the same hardware?

Really on the same computer, the same code files, just using a different compiler



refer to 6th floor ztenv response:
you this is the feeling of release and debug contrast, such as 3 floor, O2 and O3 or - try

I changed my own desktop, tested code, g + + compiler version or 7.3.0, time is
1002100
If compilation command - O3 is
997500

The same computer, use vs2019 compiled 64 release version, the value of
4746



Using duration_cast & lt; Ms & gt; (endTime - startTime). The count () is transformed into a unit
  • Related