From: Carsten Haitzler (Rasterman) Date: Sat, 17 Oct 2015 02:42:46 +0000 (+0900) Subject: eo - another 1.5 percent speedup in eo_bench eo_do by removing err handl X-Git-Tag: v1.16.0-beta2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94ebd96df509c36a8d0d12b3e5c9befbf0287441;p=platform%2Fupstream%2Fefl.git 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. --- 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) 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)