Created
November 15, 2012 17:14
-
-
Save retep998/4079845 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 <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