summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-10-17 11:42:46 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-10-17 11:42:46 +0900
commit94ebd96df509c36a8d0d12b3e5c9befbf0287441 (patch)
treeb7851885be600c6d5faa6b25454b3298c5b481d1 /src
parent1a135fdfb1265154057c7b47041b1bea4e3207b6 (diff)
eo - another 1.5 percent speedup in eo_bench eo_do by removing err handl
so we do a bit of error handling like does a stack fail to allocate, does setting the tls var fail, have the stack frames been nulled or not allocated, etc. - these acutally cost every call because they mean some extra compare and branches, but ore because they cause a lot fo extra code to be generated, thus polluting instruction cache with code and cacheline fetches of code that we rarely take - if ever. every if () and DBG, ERR etc. does cost something. in really hotpath code like this, i think it's best we realize that these checks will basically never be triggered, because if a stack fails to grow... we likely alreayd blew our REAL stack for the C/C++ side and that can't allocate anymore and has already just crashed (no magic message there - just segv). so in this case i think this checking is pointless and just costs us rather than gets us anything.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eo/eo.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 27073f6..34713f3 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -389,18 +389,7 @@ _eo_call_stack_get_thread(void)
389 if (stack) return stack; 389 if (stack) return stack;
390 390
391 stack = _eo_call_stack_create(); 391 stack = _eo_call_stack_create();
392 if (!stack) 392 eina_tls_set(_eo_call_stack_key, stack);
393 {
394 EINA_LOG_ERR("Could not alloc eo call stack.");
395 return NULL;
396 }
397
398 if (!eina_tls_set(_eo_call_stack_key, stack))
399 {
400 EINA_LOG_ERR("Could not set eo call stack in TLS key.");
401 _eo_call_stack_free(stack);
402 return NULL;
403 }
404 393
405 return stack; 394 return stack;
406} 395}
@@ -424,15 +413,9 @@ _eo_call_stack_resize(Eo_Call_Stack *stack, Eina_Bool grow)
424 next_sz = sz / 2; 413 next_sz = sz / 2;
425 frame_offset = stack->frame_ptr - stack->frames; 414 frame_offset = stack->frame_ptr - stack->frames;
426 415
427 DBG("resize from %lu to %lu", (long unsigned int)sz, (long unsigned int)next_sz);
428 _eo_call_stack_mem_resize((void **)&(stack->frames), 416 _eo_call_stack_mem_resize((void **)&(stack->frames),
429 next_sz * sizeof(Eo_Stack_Frame), 417 next_sz * sizeof(Eo_Stack_Frame),
430 sz * sizeof(Eo_Stack_Frame)); 418 sz * sizeof(Eo_Stack_Frame));
431 if (!stack->frames)
432 {
433 CRI("unable to resize call stack, abort.");
434 abort();
435 }
436 419
437 stack->frame_ptr = &stack->frames[frame_offset]; 420 stack->frame_ptr = &stack->frames[frame_offset];
438 stack->last_frame = &stack->frames[next_sz - 1]; 421 stack->last_frame = &stack->frames[next_sz - 1];
@@ -535,12 +518,6 @@ _eo_do_end(void *eo_stack)
535 518
536 fptr->obj_data = EO_INVALID_DATA; 519 fptr->obj_data = EO_INVALID_DATA;
537 520
538 if (fptr == stack->frames)
539 {
540 CRI("eo call stack underflow, abort.");
541 abort();
542 }
543
544 stack->frame_ptr--; 521 stack->frame_ptr--;
545 522
546 if (fptr == stack->shrink_frame) 523 if (fptr == stack->shrink_frame)