Update hash benchmark to reflect E use (hash population under 2000, more find than add).

Current status :
 - same performance for evas, eina and glib with les than 500 items.
 - glib is then faster, eina/evas are second until 800.
 - glib remain the fastest, eina is second, and evas is starting to drop in performance.



SVN revision: 36476
This commit is contained in:
Cedric BAIL 2008-10-06 12:16:27 +00:00
parent 554ad88eff
commit b158ab48ed
1 changed files with 64 additions and 51 deletions

View File

@ -78,6 +78,7 @@ eina_bench_lookup_rbtree(int request)
Eina_Rbtree *root = NULL;
Eina_Rbtree *tmp;
int i;
int j;
for (i = 0; i < request; ++i)
{
@ -94,6 +95,7 @@ eina_bench_lookup_rbtree(int request)
srand(time(NULL));
for (j = 0; j < 200; ++j)
for (i = 0; i < request; ++i)
{
char tmp_key[10];
@ -112,6 +114,7 @@ eina_bench_lookup_superfast(int request)
Eina_Hash *hash = NULL;
int *tmp_val;
unsigned int i;
unsigned int j;
hash = eina_hash_string_superfast_new(free);
@ -131,12 +134,12 @@ eina_bench_lookup_superfast(int request)
srand(time(NULL));
for (j = 0; j < 200; ++j)
for (i = 0; i < (unsigned int) request; ++i)
{
char tmp_key[10];
eina_convert_itoa(rand() % request, tmp_key);
tmp_val = eina_hash_find(hash, tmp_key);
}
@ -149,6 +152,7 @@ eina_bench_lookup_djb2(int request)
Eina_Hash *hash = NULL;
int *tmp_val;
unsigned int i;
unsigned int j;
hash = eina_hash_string_djb2_new(free);
@ -168,6 +172,7 @@ eina_bench_lookup_djb2(int request)
srand(time(NULL));
for (j = 0; j < 200; ++j)
for (i = 0; i < (unsigned int) request; ++i)
{
char tmp_key[10];
@ -193,6 +198,7 @@ eina_bench_lookup_djb2_inline(int request)
Eina_Hash *hash = NULL;
Eina_Bench_DJB2 *elm;
unsigned int i;
unsigned int j;
hash = eina_hash_string_djb2_new(free);
@ -213,6 +219,7 @@ eina_bench_lookup_djb2_inline(int request)
srand(time(NULL));
for (j = 0; j < 200; ++j)
for (i = 0; i < (unsigned int) request; ++i)
{
char tmp_key[10];
@ -240,6 +247,7 @@ eina_bench_lookup_ghash(int request)
Eina_Bench_Glib *elm;
GHashTable *hash;
unsigned int i;
unsigned int j;
hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, free);
@ -258,6 +266,7 @@ eina_bench_lookup_ghash(int request)
srand(time(NULL));
for (j = 0; j < 200; ++j)
for (i = 0; i < (unsigned int) request; ++i)
{
char tmp_key[10];
@ -280,6 +289,7 @@ eina_bench_lookup_evas(int request)
int *tmp_val;
Eina_Array_Iterator it;
unsigned int i;
unsigned int j;
array = eina_array_new(1000);
@ -301,6 +311,7 @@ eina_bench_lookup_evas(int request)
srand(time(NULL));
for (j = 0; j < 200; ++j)
for (i = 0; i < (unsigned int) request; ++i)
{
char tmp_key[10];
@ -333,6 +344,7 @@ eina_bench_lookup_ecore(int request)
Ecore_Hash *hash = NULL;
Eina_Bench_Ecore *elm;
unsigned int i;
unsigned int j;
hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
@ -353,6 +365,7 @@ eina_bench_lookup_ecore(int request)
srand(time(NULL));
for (j = 0; j < 200; ++j)
for (i = 0; i < (unsigned int) request; ++i)
{
char tmp_key[10];
@ -368,17 +381,17 @@ eina_bench_lookup_ecore(int request)
void eina_bench_hash(Eina_Benchmark *bench)
{
eina_benchmark_register(bench, "superfast-lookup", EINA_BENCHMARK(eina_bench_lookup_superfast), 10, 8000, 50);
eina_benchmark_register(bench, "djb2-lookup", EINA_BENCHMARK(eina_bench_lookup_djb2), 10, 8000, 50);
eina_benchmark_register(bench, "djb2-lookup-inline", EINA_BENCHMARK(eina_bench_lookup_djb2_inline), 10, 8000, 50);
eina_benchmark_register(bench, "rbtree", EINA_BENCHMARK(eina_bench_lookup_rbtree), 10, 8000, 50);
eina_benchmark_register(bench, "superfast-lookup", EINA_BENCHMARK(eina_bench_lookup_superfast), 10, 2000, 10);
eina_benchmark_register(bench, "djb2-lookup", EINA_BENCHMARK(eina_bench_lookup_djb2), 10, 2000, 10);
eina_benchmark_register(bench, "djb2-lookup-inline", EINA_BENCHMARK(eina_bench_lookup_djb2_inline), 10, 2000, 10);
eina_benchmark_register(bench, "rbtree", EINA_BENCHMARK(eina_bench_lookup_rbtree), 10, 2000, 10);
#ifdef EINA_BENCH_HAVE_GLIB
eina_benchmark_register(bench, "ghash-lookup", EINA_BENCHMARK(eina_bench_lookup_ghash), 10, 8000, 50);
eina_benchmark_register(bench, "ghash-lookup", EINA_BENCHMARK(eina_bench_lookup_ghash), 10, 2000, 10);
#endif
#ifdef EINA_BENCH_HAVE_EVAS
eina_benchmark_register(bench, "evas-lookup", EINA_BENCHMARK(eina_bench_lookup_evas), 10, 8000, 50);
eina_benchmark_register(bench, "evas-lookup", EINA_BENCHMARK(eina_bench_lookup_evas), 10, 2000, 10);
#endif
#ifdef EINA_BENCH_HAVE_ECORE
eina_benchmark_register(bench, "ecore-lookup", EINA_BENCHMARK(eina_bench_lookup_ecore), 10, 8000, 50);
eina_benchmark_register(bench, "ecore-lookup", EINA_BENCHMARK(eina_bench_lookup_ecore), 10, 2000, 10);
#endif
}