aboutsummaryrefslogtreecommitdiffstats
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
parentevas - clean if check to be a single return point for clarity (diff)
downloadefl-94ebd96df509c36a8d0d12b3e5c9befbf0287441.tar.gz
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.
-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 27073f6c9a..34713f32c9 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -389,18 +389,7 @@ _eo_call_stack_get_thread(void)
if (stack) return stack;
stack = _eo_call_stack_create();
- if (!stack)
- {
- EINA_LOG_ERR("Could not alloc eo call stack.");
- return NULL;
- }
-
- if (!eina_tls_set(_eo_call_stack_key, stack))
- {
- EINA_LOG_ERR("Could not set eo call stack in TLS key.");
- _eo_call_stack_free(stack);
- return NULL;
- }
+ eina_tls_set(_eo_call_stack_key, stack);
return stack;
}
@@ -424,15 +413,9 @@ _eo_call_stack_resize(Eo_Call_Stack *stack, Eina_Bool grow)
next_sz = sz / 2;
frame_offset = stack->frame_ptr - stack->frames;
- DBG("resize from %lu to %lu", (long unsigned int)sz, (long unsigned int)next_sz);
_eo_call_stack_mem_resize((void **)&(stack->frames),
next_sz * sizeof(Eo_Stack_Frame),
sz * sizeof(Eo_Stack_Frame));
- if (!stack->frames)
- {
- CRI("unable to resize call stack, abort.");
- abort();
- }
stack->frame_ptr = &stack->frames[frame_offset];
stack->last_frame = &stack->frames[next_sz - 1];
@@ -535,12 +518,6 @@ _eo_do_end(void *eo_stack)
fptr->obj_data = EO_INVALID_DATA;
- if (fptr == stack->frames)
- {
- CRI("eo call stack underflow, abort.");
- abort();
- }
-
stack->frame_ptr--;
if (fptr == stack->shrink_frame)