aboutsummaryrefslogtreecommitdiffstats
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
parentEo benchmark: Fix super benchmark. (diff)
downloadefl-862372ed2316d23e657f3562a4d5c77d05bd8849.tar.gz
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 @@
#define MY_CLASS SIMPLE_CLASS
static void
+_other_call(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, Eo *other, int times)
+{
+ if (times > 0)
+ {
+ eo_do(other, simple_other_call(obj, times-1));
+ }
+}
+
+EAPI EO_VOID_FUNC_BODYV(simple_other_call, EO_FUNC_CALL(other, times), Eo *other, int times);
+
+static void
_a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
{
Simple_Public_Data *pd = class_data;
@@ -18,6 +29,7 @@ EAPI EO_VOID_FUNC_BODYV(simple_a_set, EO_FUNC_CALL(a), int a);
static Eo_Op_Description op_desc[] = {
EO_OP_FUNC(simple_a_set, _a_set),
+ EO_OP_FUNC(simple_other_call, _other_call),
};
static 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
} Simple_Public_Data;
EAPI void simple_a_set(int a);
+/* Calls simple_other_call(other, obj) and then simple_other_call(obj, other)
+ * for 'times' times in order to grow the call stack on other objects. */
+EAPI void simple_other_call(Eo *other, int times);
#define SIMPLE_CLASS simple_class_get()
const 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 @@
void eo_bench_eo_do(Eina_Benchmark *bench);
void eo_bench_eo_add(Eina_Benchmark *bench);
+#define _EO_BENCH_TIMES(Start, Repeat, Jump) (Start), ((Start) + ((Jump) * (Repeat))), (Jump)
+
#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)
void eo_bench_eo_add(Eina_Benchmark *bench)
{
eina_benchmark_register(bench, "eo_add_linear",
- EINA_BENCHMARK(bench_eo_add_linear), 1000, 50000, 100);
+ EINA_BENCHMARK(bench_eo_add_linear), _EO_BENCH_TIMES(1000, 10, 50000));
eina_benchmark_register(bench, "eo_add_jump_by_2",
- EINA_BENCHMARK(bench_eo_add_jump_by_2), 1000, 50000, 100);
+ EINA_BENCHMARK(bench_eo_add_jump_by_2), _EO_BENCH_TIMES(1000, 10, 50000));
}
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 @@
#include "class_simple.h"
static void
-bench_eo_do_general(int request)
+bench_eo_do_simple(int request)
{
int i;
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
@@ -19,6 +19,37 @@ bench_eo_do_general(int request)
eo_unref(obj);
}
+static void
+bench_eo_do_two_objs(int request)
+{
+ int i;
+ Eo *obj = eo_add(SIMPLE_CLASS, NULL);
+ Eo *obj2 = eo_add(SIMPLE_CLASS, NULL);
+ for (i = 0 ; i < request ; i++)
+ {
+ eo_do(obj, simple_a_set(i));
+ eo_do(obj2, simple_a_set(i));
+ }
+
+ eo_unref(obj);
+ eo_unref(obj2);
+}
+
+static void
+bench_eo_do_two_objs_growing_stack(int request)
+{
+ int i;
+ Eo *obj = eo_add(SIMPLE_CLASS, NULL);
+ Eo *obj2 = eo_add(SIMPLE_CLASS, NULL);
+ for (i = 0 ; i < request ; i++)
+ {
+ eo_do(obj, simple_other_call(obj2, 20));
+ }
+
+ eo_unref(obj);
+ eo_unref(obj2);
+}
+
static const Eo_Class *cur_klass;
static void
@@ -58,8 +89,12 @@ bench_eo_do_super(int request)
void eo_bench_eo_do(Eina_Benchmark *bench)
{
- eina_benchmark_register(bench, "various",
- EINA_BENCHMARK(bench_eo_do_general), 1000, 100000, 500);
+ eina_benchmark_register(bench, "simple",
+ EINA_BENCHMARK(bench_eo_do_simple), _EO_BENCH_TIMES(1000, 10, 500000));
eina_benchmark_register(bench, "super",
- EINA_BENCHMARK(bench_eo_do_super), 1000, 100000, 500);
+ EINA_BENCHMARK(bench_eo_do_super), _EO_BENCH_TIMES(1000, 10, 500000));
+ eina_benchmark_register(bench, "two_objs",
+ EINA_BENCHMARK(bench_eo_do_two_objs), _EO_BENCH_TIMES(1000, 10, 500000));
+ eina_benchmark_register(bench, "two_objs_growing_stack",
+ EINA_BENCHMARK(bench_eo_do_two_objs_growing_stack), _EO_BENCH_TIMES(1000, 10, 40000));
}