summaryrefslogtreecommitdiff
path: root/src/benchmarks
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-14 10:54:02 +0100
committerTom Hacohen <tom@stosb.com>2015-11-09 11:43:04 +0000
commit862372ed2316d23e657f3562a4d5c77d05bd8849 (patch)
treee9dc064bb0a2de6982bc138108a88968920c29d3 /src/benchmarks
parent9f6ec045a7e5d9a1f1be360e282051821a4c4cc6 (diff)
Eo benchmarks: Improve benchmarks.
Add more cases, and tune the number of times we test.
Diffstat (limited to 'src/benchmarks')
-rw-r--r--src/benchmarks/eo/class_simple.c12
-rw-r--r--src/benchmarks/eo/class_simple.h3
-rw-r--r--src/benchmarks/eo/eo_bench.h2
-rw-r--r--src/benchmarks/eo/eo_bench_eo_add.c4
-rw-r--r--src/benchmarks/eo/eo_bench_eo_do.c43
5 files changed, 58 insertions, 6 deletions
diff --git a/src/benchmarks/eo/class_simple.c b/src/benchmarks/eo/class_simple.c
index 5923825d4e..7ff15db595 100644
--- a/src/benchmarks/eo/class_simple.c
+++ b/src/benchmarks/eo/class_simple.c
@@ -8,6 +8,17 @@
8#define MY_CLASS SIMPLE_CLASS 8#define MY_CLASS SIMPLE_CLASS
9 9
10static void 10static void
11_other_call(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, Eo *other, int times)
12{
13 if (times > 0)
14 {
15 eo_do(other, simple_other_call(obj, times-1));
16 }
17}
18
19EAPI EO_VOID_FUNC_BODYV(simple_other_call, EO_FUNC_CALL(other, times), Eo *other, int times);
20
21static void
11_a_set(Eo *obj EINA_UNUSED, void *class_data, int a) 22_a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
12{ 23{
13 Simple_Public_Data *pd = class_data; 24 Simple_Public_Data *pd = class_data;
@@ -18,6 +29,7 @@ EAPI EO_VOID_FUNC_BODYV(simple_a_set, EO_FUNC_CALL(a), int a);
18 29
19static Eo_Op_Description op_desc[] = { 30static Eo_Op_Description op_desc[] = {
20 EO_OP_FUNC(simple_a_set, _a_set), 31 EO_OP_FUNC(simple_a_set, _a_set),
32 EO_OP_FUNC(simple_other_call, _other_call),
21}; 33};
22 34
23static const Eo_Class_Description class_desc = { 35static const Eo_Class_Description class_desc = {
diff --git a/src/benchmarks/eo/class_simple.h b/src/benchmarks/eo/class_simple.h
index 99f6b80c09..1d78188fe1 100644
--- a/src/benchmarks/eo/class_simple.h
+++ b/src/benchmarks/eo/class_simple.h
@@ -7,6 +7,9 @@ typedef struct
7} Simple_Public_Data; 7} Simple_Public_Data;
8 8
9EAPI void simple_a_set(int a); 9EAPI void simple_a_set(int a);
10/* Calls simple_other_call(other, obj) and then simple_other_call(obj, other)
11 * for 'times' times in order to grow the call stack on other objects. */
12EAPI void simple_other_call(Eo *other, int times);
10 13
11#define SIMPLE_CLASS simple_class_get() 14#define SIMPLE_CLASS simple_class_get()
12const Eo_Class *simple_class_get(void); 15const Eo_Class *simple_class_get(void);
diff --git a/src/benchmarks/eo/eo_bench.h b/src/benchmarks/eo/eo_bench.h
index 2513426314..9e3e80d82f 100644
--- a/src/benchmarks/eo/eo_bench.h
+++ b/src/benchmarks/eo/eo_bench.h
@@ -4,4 +4,6 @@
4void eo_bench_eo_do(Eina_Benchmark *bench); 4void eo_bench_eo_do(Eina_Benchmark *bench);
5void eo_bench_eo_add(Eina_Benchmark *bench); 5void eo_bench_eo_add(Eina_Benchmark *bench);
6 6
7#define _EO_BENCH_TIMES(Start, Repeat, Jump) (Start), ((Start) + ((Jump) * (Repeat))), (Jump)
8
7#endif 9#endif
diff --git a/src/benchmarks/eo/eo_bench_eo_add.c b/src/benchmarks/eo/eo_bench_eo_add.c
index ce0bdc9c8c..462f3b9c56 100644
--- a/src/benchmarks/eo/eo_bench_eo_add.c
+++ b/src/benchmarks/eo/eo_bench_eo_add.c
@@ -41,7 +41,7 @@ bench_eo_add_jump_by_2(int request)
41void eo_bench_eo_add(Eina_Benchmark *bench) 41void eo_bench_eo_add(Eina_Benchmark *bench)
42{ 42{
43 eina_benchmark_register(bench, "eo_add_linear", 43 eina_benchmark_register(bench, "eo_add_linear",
44 EINA_BENCHMARK(bench_eo_add_linear), 1000, 50000, 100); 44 EINA_BENCHMARK(bench_eo_add_linear), _EO_BENCH_TIMES(1000, 10, 50000));
45 eina_benchmark_register(bench, "eo_add_jump_by_2", 45 eina_benchmark_register(bench, "eo_add_jump_by_2",
46 EINA_BENCHMARK(bench_eo_add_jump_by_2), 1000, 50000, 100); 46 EINA_BENCHMARK(bench_eo_add_jump_by_2), _EO_BENCH_TIMES(1000, 10, 50000));
47} 47}
diff --git a/src/benchmarks/eo/eo_bench_eo_do.c b/src/benchmarks/eo/eo_bench_eo_do.c
index 36abc1417a..2bcdc4246e 100644
--- a/src/benchmarks/eo/eo_bench_eo_do.c
+++ b/src/benchmarks/eo/eo_bench_eo_do.c
@@ -7,7 +7,7 @@
7#include "class_simple.h" 7#include "class_simple.h"
8 8
9static void 9static void
10bench_eo_do_general(int request) 10bench_eo_do_simple(int request)
11{ 11{
12 int i; 12 int i;
13 Eo *obj = eo_add(SIMPLE_CLASS, NULL); 13 Eo *obj = eo_add(SIMPLE_CLASS, NULL);
@@ -19,6 +19,37 @@ bench_eo_do_general(int request)
19 eo_unref(obj); 19 eo_unref(obj);
20} 20}
21 21
22static void
23bench_eo_do_two_objs(int request)
24{
25 int i;
26 Eo *obj = eo_add(SIMPLE_CLASS, NULL);
27 Eo *obj2 = eo_add(SIMPLE_CLASS, NULL);
28 for (i = 0 ; i < request ; i++)
29 {
30 eo_do(obj, simple_a_set(i));
31 eo_do(obj2, simple_a_set(i));
32 }
33
34 eo_unref(obj);
35 eo_unref(obj2);
36}
37
38static void
39bench_eo_do_two_objs_growing_stack(int request)
40{
41 int i;
42 Eo *obj = eo_add(SIMPLE_CLASS, NULL);
43 Eo *obj2 = eo_add(SIMPLE_CLASS, NULL);
44 for (i = 0 ; i < request ; i++)
45 {
46 eo_do(obj, simple_other_call(obj2, 20));
47 }
48
49 eo_unref(obj);
50 eo_unref(obj2);
51}
52
22static const Eo_Class *cur_klass; 53static const Eo_Class *cur_klass;
23 54
24static void 55static void
@@ -58,8 +89,12 @@ bench_eo_do_super(int request)
58 89
59void eo_bench_eo_do(Eina_Benchmark *bench) 90void eo_bench_eo_do(Eina_Benchmark *bench)
60{ 91{
61 eina_benchmark_register(bench, "various", 92 eina_benchmark_register(bench, "simple",
62 EINA_BENCHMARK(bench_eo_do_general), 1000, 100000, 500); 93 EINA_BENCHMARK(bench_eo_do_simple), _EO_BENCH_TIMES(1000, 10, 500000));
63 eina_benchmark_register(bench, "super", 94 eina_benchmark_register(bench, "super",
64 EINA_BENCHMARK(bench_eo_do_super), 1000, 100000, 500); 95 EINA_BENCHMARK(bench_eo_do_super), _EO_BENCH_TIMES(1000, 10, 500000));
96 eina_benchmark_register(bench, "two_objs",
97 EINA_BENCHMARK(bench_eo_do_two_objs), _EO_BENCH_TIMES(1000, 10, 500000));
98 eina_benchmark_register(bench, "two_objs_growing_stack",
99 EINA_BENCHMARK(bench_eo_do_two_objs_growing_stack), _EO_BENCH_TIMES(1000, 10, 40000));
65} 100}