summaryrefslogtreecommitdiff
path: root/src/benchmarks/eina/eina_bench_promise.c
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-30 17:01:40 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-30 17:01:40 -0300
commit1eafe1d16acfa77819b33552cce140e83511c7ad (patch)
treecd560fa89c3593f4b4088d52a6c59c1f237b56cf /src/benchmarks/eina/eina_bench_promise.c
parent6e02d52fbb407e3154a8b990f6403a91697e4cbf (diff)
eina: Add non-allocated version to benchmark
Diffstat (limited to '')
-rw-r--r--src/benchmarks/eina/eina_bench_promise.c79
1 files changed, 75 insertions, 4 deletions
diff --git a/src/benchmarks/eina/eina_bench_promise.c b/src/benchmarks/eina/eina_bench_promise.c
index 00d55cc955..0d1afc5d5d 100644
--- a/src/benchmarks/eina/eina_bench_promise.c
+++ b/src/benchmarks/eina/eina_bench_promise.c
@@ -334,6 +334,71 @@ eina_bench_promise_pointer_value_set_after_then_pooled(int request)
334 eina_shutdown(); 334 eina_shutdown();
335} 335}
336 336
337static void
338eina_bench_promise_pointer_value_set_before_then_non_alloc(int request)
339{
340 const char *tmp;
341 unsigned int j;
342 int i;
343
344 eina_init();
345
346 mempool = eina_mempool_add("chained_mempool", "", NULL, sizeof(struct value_type), 10);
347 assert(mempool != NULL);
348
349 for (j = 0; j != 200; ++j)
350 for (i = 0; i != request; ++i)
351 {
352 Eina_Promise_Owner* owner = eina_promise_default_add(sizeof(struct value_type*));
353 Eina_Promise* promise = eina_promise_owner_promise_get(owner);
354
355 struct value_type v = {0,0,0,0};
356 *(struct value_type**)eina_promise_owner_buffer_get(owner) = &v;
357
358 eina_promise_then(promise, &pointer_cb, NULL, NULL);
359 eina_promise_owner_value_set(owner, NULL, &indirect_mempool_free);
360 }
361
362 /* Suppress warnings as we really don't want to do anything. */
363 (void) tmp;
364
365 eina_mempool_del(mempool);
366
367 eina_shutdown();
368}
369
370static void
371eina_bench_promise_pointer_value_set_after_then_non_alloc(int request)
372{
373 const char *tmp;
374 unsigned int j;
375 int i;
376
377 eina_init();
378
379 mempool = eina_mempool_add("chained_mempool", "", NULL, sizeof(struct value_type), 10);
380 assert(mempool != NULL);
381
382 for (j = 0; j != 200; ++j)
383 for (i = 0; i != request; ++i)
384 {
385 Eina_Promise_Owner* owner = eina_promise_default_add(sizeof(struct value_type*));
386 Eina_Promise* promise = eina_promise_owner_promise_get(owner);
387
388 struct value_type v = {0,0,0,0};
389 *(struct value_type**)eina_promise_owner_buffer_get(owner) = &v;
390
391 eina_promise_owner_value_set(owner, NULL, &indirect_mempool_free);
392 eina_promise_then(promise, &pointer_cb, NULL, NULL);
393 }
394
395 /* Suppress warnings as we really don't want to do anything. */
396 (void) tmp;
397
398 eina_mempool_del(mempool);
399 eina_shutdown();
400}
401
337void eina_bench_promise(Eina_Benchmark *bench) 402void eina_bench_promise(Eina_Benchmark *bench)
338{ 403{
339 eina_benchmark_register(bench, "promise synchronous then", 404 eina_benchmark_register(bench, "promise synchronous then",
@@ -351,16 +416,22 @@ void eina_bench_promise(Eina_Benchmark *bench)
351 eina_benchmark_register(bench, "promise no copy value set before then", 416 eina_benchmark_register(bench, "promise no copy value set before then",
352 EINA_BENCHMARK( 417 EINA_BENCHMARK(
353 eina_bench_promise_no_copy_value_set_before_then), 100, 20100, 500); 418 eina_bench_promise_no_copy_value_set_before_then), 100, 20100, 500);
419 eina_benchmark_register(bench, "promise pointer value set after then mempool",
420 EINA_BENCHMARK(
421 eina_bench_promise_pointer_value_set_after_then_pooled), 100, 20100, 500);
422 eina_benchmark_register(bench, "promise pointer value set before then mempool",
423 EINA_BENCHMARK(
424 eina_bench_promise_pointer_value_set_before_then_pooled), 100, 20100, 500);
354 eina_benchmark_register(bench, "promise pointer value set after then", 425 eina_benchmark_register(bench, "promise pointer value set after then",
355 EINA_BENCHMARK( 426 EINA_BENCHMARK(
356 eina_bench_promise_pointer_value_set_after_then), 100, 20100, 500); 427 eina_bench_promise_pointer_value_set_after_then), 100, 20100, 500);
357 eina_benchmark_register(bench, "promise pointer value set before then", 428 eina_benchmark_register(bench, "promise pointer value set before then",
358 EINA_BENCHMARK( 429 EINA_BENCHMARK(
359 eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500); 430 eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500);
360 eina_benchmark_register(bench, "promise pointer value set after then mempool", 431 eina_benchmark_register(bench, "promise pointer value set after then non alloc",
361 EINA_BENCHMARK( 432 EINA_BENCHMARK(
362 eina_bench_promise_pointer_value_set_after_then_pooled), 100, 20100, 500); 433 eina_bench_promise_pointer_value_set_after_then_non_alloc), 100, 20100, 500);
363 eina_benchmark_register(bench, "promise pointer value set before then mempool", 434 eina_benchmark_register(bench, "promise pointer value set before then non alloc",
364 EINA_BENCHMARK( 435 EINA_BENCHMARK(
365 eina_bench_promise_pointer_value_set_before_then_pooled), 100, 20100, 500); 436 eina_bench_promise_pointer_value_set_before_then_non_alloc), 100, 20100, 500);
366} 437}