Change a little bit the benchmarks to be more representative.
This commit is contained in:
1 parent
671c600b05
commit
54a3a4cd9c
6 files changed
+20
-11
No files matched your search
@@ -106,6 +106,7 @@ static void test_rbtree(size_t n)
|
||||
*p = rand_get();
|
||||
g_tree_insert(tree, p, NULL);
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
unsigned long key = rand_get();
|
||||
@@ -143,6 +144,7 @@ test_dict(unsigned long n)
|
||||
*value = rand_get();
|
||||
g_hash_table_insert(dict, key, value );
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
unsigned long key = rand_get();
|
||||
@@ -186,6 +188,7 @@ test_dict_big(unsigned long n)
|
||||
sprintf(*value, "%u", rand_get());
|
||||
g_hash_table_insert(dict, key, value );
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
char_array_t s1;
|
||||
|
||||
@@ -115,6 +115,7 @@ static void test_rbtree(size_t n)
|
||||
kb_putp(kTree, tree, &j);
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
unsigned long j = 0;
|
||||
@@ -143,6 +144,7 @@ test_dict(unsigned long n)
|
||||
khiter_t k = kh_put(iun, dict, rand_get(), &ret);
|
||||
kh_value(dict, k) = rand_get();
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
khiter_t k = kh_get(iun, dict, rand_get());
|
||||
@@ -185,6 +187,7 @@ test_dict_big(unsigned long n)
|
||||
khiter_t k = kh_put(iub, dict, s1, &ret);
|
||||
char_set(&kh_value(dict, k), s2);
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
char_array_t s1;
|
||||
|
||||
@@ -106,6 +106,7 @@ test_dict(unsigned long n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
map_insert(&dict, (map_element[]) {{.key = rand_get(), .value = rand_get()}}, hash_func, equal_func, set_func, NULL);
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
map_element *p = map_at(&dict, (map_element[]){{.key = rand_get()}}, hash_func, equal_func);
|
||||
@@ -163,6 +164,7 @@ test_dict_big(unsigned long n)
|
||||
sprintf(el.value, "%u", rand_get());
|
||||
map_insert(&dict, &el, char_hash, char_equal, char_set, NULL);
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
big_map_element el;
|
||||
|
||||
+4
-3
@@ -116,7 +116,7 @@ static void test_rbtree(size_t n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
rbtree_ulong_push(tree, rand_get());
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
unsigned long *p = rbtree_ulong_get(tree, rand_get());
|
||||
@@ -149,7 +149,7 @@ test_dict(unsigned long n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
dict_ulong_set_at(dict, rand_get(), rand_get() );
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
unsigned long *p = dict_ulong_get(dict, rand_get());
|
||||
@@ -172,7 +172,7 @@ static void char_set (char_array_t a, const char_array_t b) { strcpy(a, b); }
|
||||
static bool char_equal_p (const char_array_t a, const char_array_t b) { return strcmp(a,b)==0; }
|
||||
static size_t char_hash(const char_array_t a) { return m_core_hash (a, strlen(a)); }
|
||||
|
||||
// NOTE: Can't set OPLIST as a macro!
|
||||
// NOTE: Can't use the name OPLIST as a macro!
|
||||
#define CHAR_OPLIST (INIT(char_init), INIT_SET(char_set), SET(char_set), CLEAR(char_init), HASH(char_hash), EQUAL(char_equal_p))
|
||||
|
||||
#ifdef USE_MEMPOOL
|
||||
@@ -195,6 +195,7 @@ test_dict_big(unsigned long n)
|
||||
sprintf(s2, "%u", rand_get());
|
||||
dict_char_set_at(dict, s1, s2);
|
||||
}
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
char_array_t s1;
|
||||
|
||||
+4
-4
@@ -95,7 +95,7 @@ static void test_rbtree(size_t n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
tree[rand_get()] = QHashDummyValue();
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
QMap<unsigned long, QHashDummyValue>::iterator it = tree.find(rand_get());
|
||||
@@ -116,7 +116,7 @@ test_dict1(unsigned long n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
dict[rand_get()] = rand_get();
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
QMap<unsigned long, unsigned long>::iterator it = dict.find(rand_get());
|
||||
@@ -137,7 +137,7 @@ test_dict2(unsigned long n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
dict[rand_get()] = rand_get();
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
QHash<unsigned long, unsigned long>::iterator it = dict.find(rand_get());
|
||||
@@ -175,7 +175,7 @@ test_dict_big(unsigned long n)
|
||||
sprintf(s2.a, "%u", rand_get());
|
||||
dict[s1] = s2;
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
char_array_s s1;
|
||||
|
||||
+4
-4
@@ -94,7 +94,7 @@ static void test_rbtree(size_t n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
tree.insert(rand_get());
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
set<unsigned long>::iterator it = tree.find(rand_get());
|
||||
@@ -115,7 +115,7 @@ test_dict1(unsigned long n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
dict[rand_get()] = rand_get();
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
map<unsigned long, unsigned long>::iterator it = dict.find(rand_get());
|
||||
@@ -136,7 +136,7 @@ test_dict2(unsigned long n)
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
dict[rand_get()] = rand_get();
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
unordered_map<unsigned long, unsigned long>::iterator it = dict.find(rand_get());
|
||||
@@ -178,7 +178,7 @@ test_dict_big(unsigned long n)
|
||||
sprintf(s2.a, "%u", rand_get());
|
||||
dict[s1] = s2;
|
||||
}
|
||||
|
||||
rand_init();
|
||||
unsigned int s = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
char_array_s s1;
|
||||
|
||||
Reference in new issue
Block a user