forked from enlightenment/efl
Include benchmark against Evas and Ecore stringshare.
SVN revision: 35995
This commit is contained in:
parent
a7f00b51bc
commit
ab37298c12
|
@ -28,6 +28,14 @@
|
|||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_EVAS
|
||||
#include <Evas.h>
|
||||
#endif
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_ECORE
|
||||
#include <Ecore_Data.h>
|
||||
#endif
|
||||
|
||||
#include "eina_stringshare.h"
|
||||
#include "eina_bench.h"
|
||||
#include "eina_convert.h"
|
||||
|
@ -96,10 +104,84 @@ eina_bench_stringchunk_job(int request)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_EVAS
|
||||
static void
|
||||
eina_bench_evas_job(int request)
|
||||
{
|
||||
const char *tmp;
|
||||
unsigned int j;
|
||||
int i;
|
||||
|
||||
evas_init();
|
||||
/* evas_stringshare_init(); */
|
||||
|
||||
for (i = 0; i < request; ++i)
|
||||
{
|
||||
char build[64] = "string_";
|
||||
|
||||
eina_convert_xtoa(i, build + 7);
|
||||
tmp = evas_stringshare_add(build);
|
||||
}
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
for (j = 0; j < 200; ++j)
|
||||
for (i = 0; i < request; ++i)
|
||||
{
|
||||
char build[64] = "string_";
|
||||
|
||||
eina_convert_xtoa(rand() % request, build + 7);
|
||||
tmp = evas_stringshare_add(build);
|
||||
}
|
||||
|
||||
/* evas_stringshare_shutdown(); */
|
||||
evas_shutdown();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_ECORE
|
||||
static void
|
||||
eina_bench_ecore_job(int request)
|
||||
{
|
||||
const char *tmp;
|
||||
unsigned int j;
|
||||
int i;
|
||||
|
||||
ecore_string_init();
|
||||
|
||||
for (i = 0; i < request; ++i)
|
||||
{
|
||||
char build[64] = "string_";
|
||||
|
||||
eina_convert_xtoa(i, build + 7);
|
||||
tmp = ecore_string_instance(build);
|
||||
}
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
for (j = 0; j < 200; ++j)
|
||||
for (i = 0; i < request; ++i)
|
||||
{
|
||||
char build[64] = "string_";
|
||||
|
||||
eina_convert_xtoa(rand() % request, build + 7);
|
||||
tmp = ecore_string_instance(build);
|
||||
}
|
||||
|
||||
ecore_string_shutdown();
|
||||
}
|
||||
#endif
|
||||
|
||||
void eina_bench_stringshare(Eina_Benchmark *bench)
|
||||
{
|
||||
eina_benchmark_register(bench, "stringshare", EINA_BENCHMARK(eina_bench_stringshare_job), 100, 20100, 500);
|
||||
#ifdef EINA_BENCH_HAVE_GLIB
|
||||
eina_benchmark_register(bench, "stringchunk (glib)", EINA_BENCHMARK(eina_bench_stringchunk_job), 100, 20100, 500);
|
||||
#endif
|
||||
#ifdef EINA_BENCH_HAVE_EVAS
|
||||
eina_benchmark_register(bench, "stringshare (evas)", EINA_BENCHMARK(eina_bench_evas_job), 100, 20100, 500);
|
||||
#endif
|
||||
#ifdef EINA_BENCH_HAVE_ECORE
|
||||
eina_benchmark_register(bench, "stringshare (ecore)", EINA_BENCHMARK(eina_bench_ecore_job), 100, 20100, 500);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue