tasn pushed a commit to branch master.

commit e4c00e098aa49929545cc31d9977fbf33a154e09
Author: Tom Hacohen <[email protected]>
Date:   Wed Mar 13 16:32:04 2013 +0000

    Eo: Added an eo_do_super benchmark.
---
 src/benchmarks/eo/eo_bench_eo_do.c | 49 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/src/benchmarks/eo/eo_bench_eo_do.c 
b/src/benchmarks/eo/eo_bench_eo_do.c
index f03aa91..601290e 100644
--- a/src/benchmarks/eo/eo_bench_eo_do.c
+++ b/src/benchmarks/eo/eo_bench_eo_do.c
@@ -19,8 +19,57 @@ bench_eo_do_general(int request)
    eo_unref(obj);
 }
 
+static const Eo_Class *cur_klass;
+
+static void
+_a_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
+{
+   int a;
+   a = va_arg(*list, int);
+
+   eo_do_super(obj, cur_klass, simple_a_set(a));
+}
+
+static void
+_class_constructor(Eo_Class *klass)
+{
+   const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
+        EO_OP_FUNC_SENTINEL
+   };
+
+   eo_class_funcs_set(klass, func_desc);
+}
+
+static void
+bench_eo_do_super(int request)
+{
+   static Eo_Class_Description class_desc = {
+        EO_VERSION,
+        "Simple2",
+        EO_CLASS_TYPE_REGULAR,
+        EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
+        NULL,
+        0,
+        _class_constructor,
+        NULL
+   };
+   cur_klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL);
+
+   int i;
+   Eo *obj = eo_add(cur_klass, NULL);
+   for (i = 0 ; i < request ; i++)
+     {
+        eo_do(obj, simple_a_set(i));
+     }
+
+   eo_unref(obj);
+}
+
 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, "super",
+         EINA_BENCHMARK(bench_eo_do_super), 1000, 100000, 500);
 }

-- 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar

Reply via email to