Windows / Linux / std :: list memory allocation

I am porting C ++ code from Linux to Windows. During this process, I found out that the following line is 10 times slower on Windows (on the same hardware):

list<char*>* item = new list<char*>[160000]; 

On Windows, ~ 10 ms is required, and on Linux, ~ 1 ms. Please note that this is the average time. Running this line 100 times takes about 1 second on Windows.

This happens on both win32 and x64, both versions are compiled into Release, and speed is measured through QueryPerformanceCounter (Windows) and gettimeofday (Linux).

The Linux compiler is gcc. The Windows compiler is VS2010.

Any idea why this could happen?

+5
source share
2 answers

. , list . , list ( 160000).

" ", , , , . , , . , , , .

Linux , clock(), ; , gettimeofday, , . ( clock() Windows, . Windows .)

+10

, ( -). , .

+2

All Articles