summaryrefslogtreecommitdiff
path: root/legacy/eina/src/tests/eina_bench_hash.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2008-08-29 09:31:25 +0000
committerCedric BAIL <cedric.bail@free.fr>2008-08-29 09:31:25 +0000
commitedad077c64a1b9b65eab56fbb85f10d138efce12 (patch)
tree71e05e70c9437a633bdd6af76f366b6ab8fd7500 /legacy/eina/src/tests/eina_bench_hash.c
parent55711fffca17340fce53120121a8a61a4c3e2859 (diff)
We don't want to bench snprintf with callgrind.
SVN revision: 35728
Diffstat (limited to '')
-rw-r--r--legacy/eina/src/tests/eina_bench_hash.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/legacy/eina/src/tests/eina_bench_hash.c b/legacy/eina/src/tests/eina_bench_hash.c
index febb4b1059..2d2eefeb4b 100644
--- a/legacy/eina/src/tests/eina_bench_hash.c
+++ b/legacy/eina/src/tests/eina_bench_hash.c
@@ -33,6 +33,7 @@
33#include "eina_array.h" 33#include "eina_array.h"
34#include "eina_bench.h" 34#include "eina_bench.h"
35#include "eina_rbtree.h" 35#include "eina_rbtree.h"
36#include "eina_convert.h"
36 37
37typedef struct _Eina_Bench_Rbtree Eina_Bench_Rbtree; 38typedef struct _Eina_Bench_Rbtree Eina_Bench_Rbtree;
38struct _Eina_Bench_Rbtree 39struct _Eina_Bench_Rbtree
@@ -72,7 +73,7 @@ eina_bench_lookup_rbtree(int request)
72 if (!tmp) continue ; 73 if (!tmp) continue ;
73 74
74 tmp->value = i; 75 tmp->value = i;
75 snprintf(tmp->key, 10, "%i", i); 76 eina_convert_itoa(i, tmp->key);
76 77
77 root = eina_rbtree_inline_insert(root, &tmp->node, EINA_RBTREE_CMP_NODE_CB(_eina_bench_rbtree_cmp), NULL); 78 root = eina_rbtree_inline_insert(root, &tmp->node, EINA_RBTREE_CMP_NODE_CB(_eina_bench_rbtree_cmp), NULL);
78 } 79 }
@@ -83,7 +84,7 @@ eina_bench_lookup_rbtree(int request)
83 { 84 {
84 char tmp_key[10]; 85 char tmp_key[10];
85 86
86 snprintf(tmp_key, 10, "%i", rand() % request); 87 eina_convert_itoa(rand() % request, tmp_key);
87 88
88 tmp = eina_rbtree_inline_lookup(root, tmp_key, 10, EINA_RBTREE_CMP_KEY_CB(_eina_bench_rbtree_key), NULL); 89 tmp = eina_rbtree_inline_lookup(root, tmp_key, 10, EINA_RBTREE_CMP_KEY_CB(_eina_bench_rbtree_key), NULL);
89 } 90 }
@@ -117,7 +118,7 @@ eina_bench_lookup_superfast(int request)
117 118
118 if (!tmp_val) continue ; 119 if (!tmp_val) continue ;
119 120
120 snprintf(tmp_key, 10, "%i", i); 121 eina_convert_itoa(i, tmp_key);
121 *tmp_val = i; 122 *tmp_val = i;
122 123
123 eina_hash_add(hash, tmp_key, tmp_val); 124 eina_hash_add(hash, tmp_key, tmp_val);
@@ -131,7 +132,7 @@ eina_bench_lookup_superfast(int request)
131 { 132 {
132 char tmp_key[10]; 133 char tmp_key[10];
133 134
134 snprintf(tmp_key, 10, "%i", rand() % request); 135 eina_convert_itoa(rand() % request, tmp_key);
135 136
136 tmp_val = eina_hash_find(hash, tmp_key); 137 tmp_val = eina_hash_find(hash, tmp_key);
137 } 138 }
@@ -165,7 +166,7 @@ eina_bench_lookup_djb2(int request)
165 166
166 if (!tmp_key || !tmp_val) continue ; 167 if (!tmp_key || !tmp_val) continue ;
167 168
168 snprintf(tmp_key, 10, "%i", i); 169 eina_convert_itoa(i, tmp_key);
169 *tmp_val = i; 170 *tmp_val = i;
170 171
171 eina_hash_add(hash, tmp_key, tmp_val); 172 eina_hash_add(hash, tmp_key, tmp_val);
@@ -179,7 +180,7 @@ eina_bench_lookup_djb2(int request)
179 { 180 {
180 char tmp_key[10]; 181 char tmp_key[10];
181 182
182 snprintf(tmp_key, 10, "%i", rand() % request); 183 eina_convert_itoa(rand() % request, tmp_key);
183 184
184 tmp_val = eina_hash_find(hash, tmp_key); 185 tmp_val = eina_hash_find(hash, tmp_key);
185 } 186 }
@@ -214,7 +215,7 @@ eina_bench_lookup_djb2_inline(int request)
214 215
215 if (!tmp_key || !tmp_val) continue ; 216 if (!tmp_key || !tmp_val) continue ;
216 217
217 length = snprintf(tmp_key, 10, "%i", i) + 1; 218 length = eina_convert_itoa(i, tmp_key) + 1;
218 *tmp_val = i; 219 *tmp_val = i;
219 220
220 eina_hash_add_by_hash(hash, tmp_key, length, eina_hash_djb2(tmp_key, length), tmp_val); 221 eina_hash_add_by_hash(hash, tmp_key, length, eina_hash_djb2(tmp_key, length), tmp_val);
@@ -229,7 +230,7 @@ eina_bench_lookup_djb2_inline(int request)
229 char tmp_key[10]; 230 char tmp_key[10];
230 int length; 231 int length;
231 232
232 length = snprintf(tmp_key, 10, "%i", rand() % request) + 1; 233 length = eina_convert_itoa(rand() % request, tmp_key) + 1;
233 234
234 tmp_val = eina_hash_find_by_hash(hash, tmp_key, length, eina_hash_djb2(tmp_key, length)); 235 tmp_val = eina_hash_find_by_hash(hash, tmp_key, length, eina_hash_djb2(tmp_key, length));
235 } 236 }
@@ -266,7 +267,7 @@ eina_bench_lookup_ghash(int request)
266 267
267 elm->key = (char*) (elm + 1); 268 elm->key = (char*) (elm + 1);
268 269
269 snprintf(elm->key, 10, "%i", i); 270 eina_convert_itoa(i, elm->key);
270 elm->value = i; 271 elm->value = i;
271 272
272 g_hash_table_insert(hash, elm->key, elm); 273 g_hash_table_insert(hash, elm->key, elm);
@@ -278,7 +279,7 @@ eina_bench_lookup_ghash(int request)
278 { 279 {
279 char tmp_key[10]; 280 char tmp_key[10];
280 281
281 snprintf(tmp_key, 10, "%i", rand() % request); 282 eina_convert_itoa(rand() % request, tmp_key);
282 283
283 elm = g_hash_table_lookup(hash, tmp_key); 284 elm = g_hash_table_lookup(hash, tmp_key);
284 } 285 }