Update benchmark: run each bench separetely to avoid bad malloc implementation bug

(Running list benchmark before array fragment the memory too much and
 generate a noticable slow down).

Add Klib bench.
o
This commit is contained in:
Patrick Pelissier committed 2017-03-24 23:54:46 +01:00
1 parent cfe79fbc01
commit e314f7c272
4 files changed
+204 -15

No files matched your search

+12 -6
View File
@@ -32,7 +32,7 @@ static void rand_init(void)
static unsigned int rand_get(void)
{
randValue = randValue * 31421U + 6927U;
return (int) randValue;
return randValue;
}
static void test_function(const char str[], size_t n, void (*func)(size_t))
@@ -141,9 +141,15 @@ test_dict2(unsigned long n)
int main(int argc, const char *argv[])
{
test_function("List time",10000000, test_list);
test_function("Array time", 100000000, test_array);
test_function("Rbtree time", 1000000, test_rbtree);
test_function("Dict(m)time", 1000000, test_dict1);
test_function("Dict(u)time", 1000000, test_dict2);
int n = (argc > 1) ? atoi(argv[1]) : 0;
if (n == 1)
test_function("List time",10000000, test_list);
if (n == 2)
test_function("Array time", 100000000, test_array);
if (n == 3)
test_function("Rbtree time", 1000000, test_rbtree);
if (n == 4)
test_function("Dict(m)time", 1000000, test_dict1);
if (n == 5)
test_function("Dict(u)time", 1000000, test_dict2);
}