diff options
Diffstat (limited to 'src/benchmarks/eina')
-rw-r--r-- | src/benchmarks/eina/Makefile.am | 1 | ||||
-rw-r--r-- | src/benchmarks/eina/eina_bench.c | 1 | ||||
-rw-r--r-- | src/benchmarks/eina/eina_bench.h | 1 | ||||
-rw-r--r-- | src/benchmarks/eina/eina_bench_json.c | 59 |
4 files changed, 62 insertions, 0 deletions
diff --git a/src/benchmarks/eina/Makefile.am b/src/benchmarks/eina/Makefile.am index 63cf39f8d0..3c8ae681a3 100644 --- a/src/benchmarks/eina/Makefile.am +++ b/src/benchmarks/eina/Makefile.am @@ -24,6 +24,7 @@ eina_bench_mempool.c \ eina_bench_stringshare_e17.c \ eina_bench_array.c \ eina_bench_rectangle_pool.c \ +eina_bench_json.c \ ecore_list.c \ ecore_strings.c \ ecore_hash.c \ diff --git a/src/benchmarks/eina/eina_bench.c b/src/benchmarks/eina/eina_bench.c index 5bd35f819b..5bb98d99e9 100644 --- a/src/benchmarks/eina/eina_bench.c +++ b/src/benchmarks/eina/eina_bench.c @@ -36,6 +36,7 @@ struct _Eina_Benchmark_Case static const Eina_Benchmark_Case etc[] = { { "Hash", eina_bench_hash }, + /* { "JSON", eina_bench_json }, */ /* { "Array vs List vs Inlist", eina_bench_array }, */ /* { "Stringshare", eina_bench_stringshare }, */ /* { "Convert", eina_bench_convert }, */ diff --git a/src/benchmarks/eina/eina_bench.h b/src/benchmarks/eina/eina_bench.h index d575822b54..6c8b12526e 100644 --- a/src/benchmarks/eina/eina_bench.h +++ b/src/benchmarks/eina/eina_bench.h @@ -29,6 +29,7 @@ void eina_bench_sort(Eina_Benchmark *bench); void eina_bench_mempool(Eina_Benchmark *bench); void eina_bench_rectangle_pool(Eina_Benchmark *bench); void eina_bench_quadtree(Eina_Benchmark *bench); +void eina_bench_json(Eina_Benchmark *bench); /* Specific benchmark. */ void eina_bench_e17(void); diff --git a/src/benchmarks/eina/eina_bench_json.c b/src/benchmarks/eina/eina_bench_json.c new file mode 100644 index 0000000000..e18eab8f7e --- /dev/null +++ b/src/benchmarks/eina/eina_bench_json.c @@ -0,0 +1,59 @@ +/* EINA - EFL data type library + * Copyright (C) 2013 Yossi Kantor + Cedric Bail + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see <http://www.gnu.org/licenses/>. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <time.h> + +#ifdef EINA_BENCH_HAVE_GLIB +# include <glib.h> +#endif + +#include "Evas_Data.h" +#include "Ecore_Data.h" + +#include "eina_json.h" +#include "eina_main.h" +#include "eina_bench.h" + +static void +eina_bench_json_parse(int request) +{ + int i; + eina_init(); + + Eina_Json_Context *jctx = eina_json_context_dom_new(); + eina_json_context_parse(jctx, "{"); + for (i = 0; i < request; i++) + eina_json_context_parse(jctx, "\"Bench\":[\"Json\", 34.5, true, null],"); + eina_json_context_parse(jctx, "\"End\":null }"); + + eina_shutdown(); +} + +void eina_bench_json(Eina_Benchmark *bench) +{ + eina_benchmark_register(bench, "json", + EINA_BENCHMARK(eina_bench_json_parse), + 100, 100000, 500); +} |