Skip to content

Instantly share code, notes, and snippets.

@htfy96
Created May 7, 2016 03:40
Show Gist options
  • Save htfy96/196c1ff1950bff4339580af5a1eedfd2 to your computer and use it in GitHub Desktop.
Save htfy96/196c1ff1950bff4339580af5a1eedfd2 to your computer and use it in GitHub Desktop.
#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