On 16/10/15 15:53, Cedric BAIL wrote: > Le 16 oct. 2015 6:53 AM, "Tom Hacohen" <t...@stosb.com> a écrit : >> >> tasn pushed a commit to branch master. >> >> > http://git.enlightenment.org/core/efl.git/commit/?id=b61556aa87ad134fe04fbdc8f953bd98d941a18e >> >> commit b61556aa87ad134fe04fbdc8f953bd98d941a18e >> Author: Tom Hacohen <t...@stosb.com> >> Date: Fri Oct 16 13:01:01 2015 +0100 >> >> Eo: Move mainloop checks inside Eo. >> >> This breaks ABI in a harmless way, and it will give us the ability to >> drastically improve Eo in the future without breaking ABI again, thus >> allowing us to declare Eo stable for this release if we choose to. > > Checking if a code is running in the main loop is costly. It is as costly > as a tls access in my test. The purpose was to reuse the value. I don't > know if the code evolved to a point we couldn't reuse the value anymore, > but did you check any performance impact ?
See the code, it was already used only once, so it was not actually reused at all. Since this is code in the header, this could have never been changed without breaking ABI anyway, which means this change actually has 0 performance impact. Well, actually, it is a slight positive impact, as you now pass less things on the stack and the "code size" is a bit smaller. I'm working on a follow up patch that improves speed drastically that actually caches some values among calls. I already finished and it's pretty awesome, but I need to just see if I can improve it a bit further before I push. I guess I can puhs now and worst can improve in a separate patch. -- Tom. > >> --- >> src/lib/eo/Eo.h | 5 ++--- >> src/lib/eo/eo.c | 7 +++---- >> 2 files changed, 5 insertions(+), 7 deletions(-) >> >> diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h >> index 9bfc060..a50a327 100644 >> --- a/src/lib/eo/Eo.h >> +++ b/src/lib/eo/Eo.h >> @@ -467,11 +467,10 @@ EAPI extern Eo_Hook_Call eo_hook_call_post; >> // cache OP id, get real fct and object data then do the call >> #define EO_FUNC_COMMON_OP(Name, DefRet) \ >> Eo_Op_Call_Data ___call; \ >> - Eina_Bool ___is_main_loop = eina_main_loop_is(); \ >> static Eo_Op ___op = EO_NOOP; \ >> if (___op == EO_NOOP) \ >> ___op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \ >> - if (!_eo_call_resolve(#Name, ___op, &___call, ___is_main_loop, > __FILE__, __LINE__)) return DefRet; \ >> + if (!_eo_call_resolve(#Name, ___op, &___call, __FILE__, __LINE__)) > return DefRet; \ >> _Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func; \ >> >> // to define an EAPI function >> @@ -538,7 +537,7 @@ EAPI extern Eo_Hook_Call eo_hook_call_post; >> EAPI Eo_Op _eo_api_op_id_get(const void *api_func); >> >> // gets the real function pointer and the object data >> -EAPI Eina_Bool _eo_call_resolve(const char *func_name, const Eo_Op op, > Eo_Op_Call_Data *call, Eina_Bool is_main_loop, const char *file, int line); >> +EAPI Eina_Bool _eo_call_resolve(const char *func_name, const Eo_Op op, > Eo_Op_Call_Data *call, const char *file, int line); >> >> // start of eo_do barrier, gets the object pointer and ref it, put it on > the stask >> EAPI Eina_Bool _eo_do_start(const Eo *obj, const Eo_Class *cur_klass, > Eina_Bool is_super, const char *file, const char *func, int line); >> diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c >> index 8006318..5f56dfa 100644 >> --- a/src/lib/eo/eo.c >> +++ b/src/lib/eo/eo.c >> @@ -491,10 +491,9 @@ _eo_do_internal(const Eo *eo_id, const Eo_Class > *cur_klass_id, >> EAPI Eina_Bool >> _eo_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, Eina_Bool > is_super, const char *file EINA_UNUSED, const char *func EINA_UNUSED, int > line EINA_UNUSED) >> { >> - Eina_Bool is_main_loop = eina_main_loop_is(); >> Eina_Bool ret = EINA_TRUE; >> Eo_Stack_Frame *fptr, *pfptr; >> - Eo_Call_Stack *stack = _eo_call_stack_get(is_main_loop); >> + Eo_Call_Stack *stack = _eo_call_stack_get(eina_main_loop_is()); >> >> if (stack->frame_ptr == stack->last_frame) >> _eo_call_stack_resize(stack, EINA_TRUE); >> @@ -543,14 +542,14 @@ _eo_do_end(void) >> } >> >> EAPI Eina_Bool >> -_eo_call_resolve(const char *func_name, const Eo_Op op, Eo_Op_Call_Data > *call, Eina_Bool is_main_loop, const char *file, int line) >> +_eo_call_resolve(const char *func_name, const Eo_Op op, Eo_Op_Call_Data > *call, const char *file, int line) >> { >> Eo_Stack_Frame *fptr; >> const _Eo_Class *klass; >> const op_type_funcs *func; >> Eina_Bool is_obj; >> >> - fptr = _eo_call_stack_get(is_main_loop)->frame_ptr; >> + fptr = _eo_call_stack_get(eina_main_loop_is())->frame_ptr; >> >> if (EINA_UNLIKELY(!fptr->o.obj)) >> return EINA_FALSE; >> >> -- >> >> >> > ------------------------------------------------------------------------------ > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel