Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualCornstalks

Posted 18 May 2013 - 01:09 AM

While we're at it, here are some clang++3.2 (Apple 4.2) results (I removed the "insertion" timings because it's not a fair test (inserting to the vector calls rand() and converts the int to double, whereas the list just copies a double)):

 

No optimizations, default standard library:

Time for sorting a vector: 0.388013
Time for sorting a list: 0.768855
 
No optimizations, libc++ library:
Time for sorting a vector: 0.258923
Time for sorting a list: 0.696469
 
O3 optimizations and NDEBUG, default standard library:
Time for sorting a vector: 0.091026
Time for sorting a list: 0.353424
 
O3 optimizations and NDEBUG, libc++ standard library:
Time for sorting a vector: 0.091312
Time for sorting a list: 0.309724

 

Running on Intel Core i7 2.7GHz with 256 KB L2 cache (per core) and 6 MB L3 cache.

 

Running it with long double gave slightly higher numbers (libc++, no optimizations):

Time for sorting a vector: 0.457013

Time for sorting a list: 0.760925

 

While running with char gave lower numbers (libc++, no optimizations):

Time for sorting a vector: 0.010401
Time for sorting a list: 0.13561
 
Indeed, I would blame your differences primarily on the cache.

#1Cornstalks

Posted 18 May 2013 - 01:07 AM

While we're at it, here are some clang++3.2 (Apple 4.2) results (I removed the "insertion" timings because it's not a fair test (inserting to the vector calls rand() and converts the int to double, whereas the list just copies a double)):

 

No optimizations, default standard library:

 

Time for sorting a vector: 0.388013
Time for sorting a list: 0.768855
 
No optimizations, libc++ library:
Time for sorting a vector: 0.258923
Time for sorting a list: 0.696469
 
O3 optimizations and NDEBUG, default standard library:
Time for sorting a vector: 0.091026
Time for sorting a list: 0.353424
 
O3 optimizations and NDEBUG, libc++ standard library:
Time for sorting a vector: 0.091312
Time for sorting a list: 0.309724

 

Running on Intel Core i7 2.7GHz with 256 KB L2 cache (per core) and 6 MB L3 cache.

 

Running it with long double gave slightly higher numbers (libc++, no optimizations):

Time for sorting a vector: 0.457013

Time for sorting a list: 0.760925

 

While running with char gave lower numbers (libc++, no optimizations):

 

Time for sorting a vector: 0.010401
Time for sorting a list: 0.13561

PARTNERS