evas render - drop eo overhead by using ptrs we already have

several calls, specifically evas_object_change_reset,
evas_object_cur_prev, and evas_object_clip_changes_clean that are
called directly or indirectly as part of evas render on at least every
active object if not more, were doing full eo obj lookups when their
calling functions already all had the eo protected data looked up.
tha's silly and just adds overhead we don't need. my test dropped
_eo_obj_pointer_get overhead in perf profiles from 4.48% to 2.65%. see:

   4.48%  libeo.so.1.18.99            [.] _eo_obj_pointer_get
   4.23%  libevas.so.1.18.99          [.] evas_render_updates_internal
   2.61%  libevas.so.1.18.99          [.] evas_render_updates_internal_loop
   1.68%  libeo.so.1.18.99            [.] efl_data_scope_get
   1.57%  libc-2.24.so                [.] _int_malloc
   1.42%  libevas.so.1.18.99          [.] evas_object_smart_changed_get
   1.09%  libevas.so.1.18.99          [.] evas_object_clip_recalc.part.37
   1.08%  libpthread-2.24.so          [.] pthread_getspecific
   1.05%  libevas.so.1.18.99          [.] efl_canvas_object_class_get
   1.01%  libevas.so.1.18.99          [.] evas_object_cur_prev
   0.99%  libeo.so.1.18.99            [.] _efl_object_event_callback_legacy_call
   0.87%  libevas.so.1.18.99          [.] _evas_render_phase1_object_ctx_render_cache_append
   0.82%  libpthread-2.24.so          [.] pthread_mutex_lock
   0.81%  libevas.so.1.18.99          [.] _evas_render_phase1_object_process
   0.79%  libc-2.24.so                [.] _int_free

vs now the improved:

   4.82%  libevas.so.1.18.99          [.] evas_render_updates_internal
   3.44%  libevas.so.1.18.99          [.] evas_render_updates_internal_loop
   2.65%  libeo.so.1.18.99            [.] _eo_obj_pointer_get
   2.22%  libc-2.24.so                [.] _int_malloc
   1.46%  libevas.so.1.18.99          [.] evas_object_smart_changed_get
   1.04%  libeo.so.1.18.99            [.] _efl_object_event_callback_legacy_call
   1.03%  libevas.so.1.18.99          [.] _evas_render_phase1_object_ctx_render_cache_append
   0.97%  libeina.so.1.18.99          [.] eina_chained_mempool_malloc
   0.93%  libevas.so.1.18.99          [.] evas_object_clip_recalc.part.37
   0.92%  libpthread-2.24.so          [.] pthread_mutex_lock
   0.91%  libevas.so.1.18.99          [.] _evas_render_phase1_object_process
   0.84%  libc-2.24.so                [.] _int_free
   0.84%  libevas.so.1.18.99          [.] evas_object_cur_prev
   0.83%  libeina.so.1.18.99          [.] eina_chained_mempool_free
   0.80%  libeo.so.1.18.99            [.] efl_data_scope_get

of course other things "increase their percentage" as oe overhead now
dropped, and things seem to move around a bit, but it does make sense
to do this with no downsides i can see as we already are accessing the
protected data ptr in the parent func.
This commit is contained in:
Carsten Haitzler 2017-02-04 11:31:55 +09:00
parent 964844821d
commit 51638afbeb
14 changed files with 61 additions and 69 deletions

View File

@ -2685,9 +2685,9 @@ evas_object_image_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_image_render_post(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj EINA_UNUSED,
void *type_private_data)
evas_object_image_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data)
{
Evas_Image_Data *o = type_private_data;
Eina_Rectangle *r;
@ -2696,7 +2696,7 @@ evas_object_image_render_post(Evas_Object *eo_obj,
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
if (o->pixels->pixel_updates)
{
@ -2709,7 +2709,7 @@ evas_object_image_render_post(Evas_Object *eo_obj,
}
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
eina_cow_memcpy(evas_object_image_state_cow, (const Eina_Cow_Data **) &o->prev, o->cur);
/* FIXME: copy strings across */
}

View File

@ -345,8 +345,8 @@ evas_object_line_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_line_render_post(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj EINA_UNUSED,
evas_object_line_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data)
{
Evas_Line_Data *o = type_private_data;
@ -355,9 +355,9 @@ evas_object_line_render_post(Evas_Object *eo_obj,
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
o->prev = o->cur;
}

View File

@ -193,10 +193,8 @@ _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data
}
void
evas_object_change_reset(Evas_Object *eo_obj)
evas_object_change_reset(Evas_Object_Protected_Data *obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, MY_CLASS);
if (!obj) return;
obj->changed = EINA_FALSE;
obj->changed_move = EINA_FALSE;
obj->changed_color = EINA_FALSE;
@ -367,10 +365,8 @@ _map_same(const void *map1, const void *map2)
}
void
evas_object_cur_prev(Evas_Object *eo_obj)
evas_object_cur_prev(Evas_Object_Protected_Data *obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, MY_CLASS);
if (!obj) return;
if (!obj->map->prev.valid_map && obj->map->prev.map)
{
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
@ -459,7 +455,7 @@ evas_object_free(Evas_Object *eo_obj, Eina_Bool clean_layer)
if (obj->clip.clipees)
obj->clip.clipees = eina_list_free(obj->clip.clipees);
obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer);
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
evas_object_event_callback_all_del(eo_obj);
evas_object_event_callback_cleanup(eo_obj);
if (obj->map->spans)
@ -679,15 +675,11 @@ evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *eo_obj EINA_
}
void
evas_object_clip_changes_clean(Evas_Object *eo_obj)
evas_object_clip_changes_clean(Evas_Object_Protected_Data *obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, MY_CLASS);
if (!obj) return;
Eina_Rectangle *r;
EINA_LIST_FREE(obj->clip.changes, r)
eina_rectangle_free(r);
EINA_LIST_FREE(obj->clip.changes, r) eina_rectangle_free(r);
}
void
@ -785,7 +777,7 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in
{
/* This is a clipper object: add regions that changed here,
* See above: EINA_LIST_FOREACH(clipper->clip.changes) */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
EINA_ARRAY_ITER_NEXT(rects, i, r, it)
obj->clip.changes = eina_list_append(obj->clip.changes, r);
eina_array_clean(rects);

View File

@ -405,17 +405,17 @@ evas_object_polygon_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_polygon_render_post(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj EINA_UNUSED,
void *type_private_data EINA_UNUSED)
evas_object_polygon_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data EINA_UNUSED)
{
/* this moves the current data to the previous state parts of the object */
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
}
static unsigned int evas_object_polygon_id_get(Evas_Object *eo_obj)

View File

@ -336,18 +336,18 @@ evas_object_rectangle_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_rectangle_render_post(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj EINA_UNUSED,
void *type_private_data EINA_UNUSED)
evas_object_rectangle_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data EINA_UNUSED)
{
/* this moves the current data to the previous state parts of the object */
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
}
static int

View File

@ -1524,10 +1524,10 @@ evas_object_smart_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_smart_render_post(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj EINA_UNUSED, void *type_private_data)
evas_object_smart_render_post(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, void *type_private_data)
{
Evas_Smart_Data *o = type_private_data;
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
o->prev = o->cur;
}

View File

@ -2143,17 +2143,17 @@ evas_object_text_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_text_render_post(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj EINA_UNUSED,
evas_object_text_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data EINA_UNUSED)
{
/* this moves the current data to the previous state parts of the object
in whatever way is safest for the object. also if we don't need object
data anymore we can free it if the object deems this is a good idea */
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
}
static unsigned int

View File

@ -14185,7 +14185,7 @@ done:
}
static void
evas_object_textblock_render_post(Evas_Object *eo_obj,
evas_object_textblock_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data EINA_UNUSED)
{
@ -14196,9 +14196,9 @@ evas_object_textblock_render_post(Evas_Object *eo_obj,
/* data anymore we can free it if the object deems this is a good idea */
/* o = (Efl_Canvas_Text_Data *)(obj->object_data); */
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
/* o->prev = o->cur; */
_filter_output_cache_prune(obj, type_private_data);
}

View File

@ -819,18 +819,18 @@ evas_object_textgrid_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_textgrid_render_post(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj EINA_UNUSED,
void *type_private_data)
evas_object_textgrid_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data)
{
/* this moves the current data to the previous state parts of the object */
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
Evas_Textgrid_Data *o = type_private_data;
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
o->prev = o->cur;
}

View File

@ -356,17 +356,17 @@ evas_object_vg_render_pre(Evas_Object *eo_obj,
}
static void
evas_object_vg_render_post(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj EINA_UNUSED,
evas_object_vg_render_post(Evas_Object *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
void *type_private_data EINA_UNUSED)
{
/* this moves the current data to the previous state parts of the object */
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
/* remove those pesky changes */
evas_object_clip_changes_clean(eo_obj);
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
}
static unsigned int

View File

@ -909,7 +909,7 @@ _evas_render_phase1_object_changed_normal(Phase1_Context *p1ctx,
by the current (hidden) state. */
if (evas_object_is_visible(eo_obj, obj) !=
evas_object_was_visible(eo_obj, obj))
evas_object_cur_prev(eo_obj);
evas_object_cur_prev(obj);
RD(level, " skip - not smart, not active or clippees or not relevant\n");
}
}
@ -1300,13 +1300,13 @@ pending_change(void *data, void *gdata EINA_UNUSED)
RD(0, " OBJ %s pending change %i -> 0, pre %i\n", RDNAME(obj), obj->changed, obj->pre_render_done);
obj->func->render_post(eo_obj, obj, obj->private_data);
obj->pre_render_done = EINA_FALSE;
evas_object_change_reset(eo_obj);
evas_object_change_reset(obj);
}
else if (!_evas_render_can_render(eo_obj, obj) &&
(!obj->is_active) && (!obj->render_pre) &&
(!obj->rect_del))
{
evas_object_change_reset(eo_obj);
evas_object_change_reset(obj);
}
if (!obj->changed) efl_data_unref(eo_obj, obj);
return obj->changed ? EINA_TRUE : EINA_FALSE;
@ -1932,7 +1932,7 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj,
push this object in an array then reset them
in the end of the rendering.*/
if (!proxy_render_data)
evas_object_change_reset(obj2->object);
evas_object_change_reset(obj2);
}
}
else
@ -2121,7 +2121,7 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj,
push this object in an array then reset them
in the end of the rendering.*/
if (!proxy_render_data)
evas_object_change_reset(obj2->object);
evas_object_change_reset(obj2);
}
}
else
@ -3292,7 +3292,7 @@ evas_render_updates_internal(Evas *eo_e,
RD(0, " OBJ %s render_post()\n", RDNAME(obj));
obj->func->render_post(eo_obj, obj, obj->private_data);
obj->restack = EINA_FALSE;
evas_object_change_reset(eo_obj);
evas_object_change_reset(obj);
}
/* moved to other pre-process phase 1
if (obj->delete_me == 2)
@ -3338,7 +3338,7 @@ evas_render_updates_internal(Evas *eo_e,
{
obj->func->render_post(eo_obj, obj, obj->private_data);
obj->restack = EINA_FALSE;
evas_object_change_reset(eo_obj);
evas_object_change_reset(obj);
}
}
eina_evlog("-render_post_reset", eo_e, 0.0, NULL);

View File

@ -123,9 +123,9 @@ _evas_render2_th_main_obj_basic_walk_process(Evas_Public_Data *e,
updates, offx, offy);
if (obj->changed)
{
evas_object_clip_changes_clean(eo_obj);
evas_object_cur_prev(eo_obj);
evas_object_change_reset(eo_obj);
evas_object_clip_changes_clean(obj);
evas_object_cur_prev(obj);
evas_object_change_reset(obj);
}
}
@ -158,9 +158,9 @@ _evas_render2_th_main_obj_walk_process(Evas_Public_Data *e,
offx, offy, l + 1);
if (obj->changed)
{
evas_object_clip_changes_clean(eo_obj);
evas_object_cur_prev(eo_obj);
evas_object_change_reset(eo_obj);
evas_object_clip_changes_clean(obj);
evas_object_cur_prev(obj);
evas_object_change_reset(obj);
}
}
else _evas_render2_th_main_obj_basic_walk_process(e, obj, updates,

View File

@ -19,7 +19,7 @@ _obj_basic_process(Evas_Public_Data *e,
obj->func->render_post(eo_obj, obj, obj->private_data);
obj->restack = EINA_FALSE;
obj->pre_render_done = EINA_FALSE;
evas_object_change_reset(eo_obj);
evas_object_change_reset(obj);
}
static void
@ -51,7 +51,7 @@ _obj_process(Evas_Public_Data *e,
obj->func->render_post(eo_obj, obj, obj->private_data);
obj->restack = EINA_FALSE;
obj->pre_render_done = EINA_FALSE;
evas_object_change_reset(eo_obj);
evas_object_change_reset(obj);
}
else _obj_basic_process(e, obj, l);
}

View File

@ -1595,16 +1595,16 @@ extern "C" {
#endif
Evas_Object *evas_object_new(Evas *e);
void evas_object_change_reset(Evas_Object *obj);
void evas_object_change_reset(Evas_Object_Protected_Data *obj);
void evas_object_clip_recalc(Evas_Object_Protected_Data *obj);
void evas_object_cur_prev(Evas_Object *obj);
void evas_object_cur_prev(Evas_Object_Protected_Data *obj);
void evas_object_free(Evas_Object *obj, Eina_Bool clean_layer);
void evas_object_update_bounding_box(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Smart_Data *s);
void evas_object_inject(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas *e);
void evas_object_release(Evas_Object *obj, Evas_Object_Protected_Data *pd, int clean_layer);
void evas_object_change(Evas_Object *obj, Evas_Object_Protected_Data *pd);
void evas_object_content_change(Evas_Object *obj, Evas_Object_Protected_Data *pd);
void evas_object_clip_changes_clean(Evas_Object *obj);
void evas_object_clip_changes_clean(Evas_Object_Protected_Data *obj);
void evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v);
void evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj);
void evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj, Evas_Object_Protected_Data *pd);