Created
May 7, 2016 03:40
-
-
Save htfy96/196c1ff1950bff4339580af5a1eedfd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <list> | |
#include <cstdlib> | |
#include <chrono> | |
using namespace std; | |
int main() | |
{ | |
list<int> l; | |
for (int i=0; i<10000000; ++i) | |
l.push_back(rand()); | |
auto start = chrono::high_resolution_clock::now(); | |
l.sort(); | |
cout << chrono::duration_cast<chrono::milliseconds>( | |
chrono::high_resolution_clock::now() - | |
start | |
).count()<< "ms" << endl; //GCC 5.3 5724ms | |
//Clang 6142ms | |
// all compiled with -O2 | |
cout << *l.rbegin() << endl; //prevent optimization | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment