Add bench for sort functions.
This commit is contained in:
1 parent
2a5829bb23
commit
d67cc326b7
6 files changed
+105
-1
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -191,6 +192,19 @@ test_dict_big(unsigned long n)
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
static void test_sort(size_t n)
|
||||
{
|
||||
rand_init();
|
||||
vector<float> a1;
|
||||
for(size_t i = 0; i < n; i++) {
|
||||
a1.push_back(rand_get() );
|
||||
}
|
||||
sort(a1.begin(), a1.end());
|
||||
g_result = a1[0];
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
int n = (argc > 1) ? atoi(argv[1]) : 0;
|
||||
@@ -206,4 +220,6 @@ int main(int argc, const char *argv[])
|
||||
test_function("Dict(u)time", 1000000, test_dict2);
|
||||
if (n == 6)
|
||||
test_function("DictB time", 1000000, test_dict_big);
|
||||
if (n == 7)
|
||||
test_function("Sort time", 10000000, test_sort);
|
||||
}
|
||||
Reference in new issue
Block a user