Skip to content

Instantly share code, notes, and snippets.

@retep998
Created November 15, 2012 17:14
Show Gist options
  • Save retep998/4079845 to your computer and use it in GitHub Desktop.
Save retep998/4079845 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <algorithm>
#include <ctime>
#include <random>
using namespace std;
size_t const s = 0x1000000;
size_t a[s];
template <typename T>
void test(T f) {
clock_t c1 = clock();
f();
clock_t c2 = clock();
cout << c2 - c1 << "ms" << endl;
}
int main() {
test([](){mt19937_64 e; for (size_t & n : a) n = e();});
test([](){sort(a, a + s);});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment