[evas_render] Downstream "evas render - drop eo overhead by using ptrs 14/129614/2
authorJoogab Yun <joogab.yun@samsung.com>
Wed, 17 May 2017 07:24:37 +0000 (16:24 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 25 May 2017 00:35:25 +0000 (00:35 +0000)
we already have" [commit id : 51638afbebc225b5a550eb87a0e74c53d866ed2e]

    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.

Change-Id: Iee7740df896537df047fac9fb0d33b450be9759f

14 files changed:
src/lib/evas/canvas/evas_object_image.c
src/lib/evas/canvas/evas_object_line.c
src/lib/evas/canvas/evas_object_main.c
src/lib/evas/canvas/evas_object_polygon.c
src/lib/evas/canvas/evas_object_rectangle.c
src/lib/evas/canvas/evas_object_smart.c
src/lib/evas/canvas/evas_object_text.c
src/lib/evas/canvas/evas_object_textblock.c
src/lib/evas/canvas/evas_object_textgrid.c
src/lib/evas/canvas/evas_object_vg.c
src/lib/evas/canvas/evas_render.c [changed mode: 0755->0644]
src/lib/evas/canvas/render2/evas_render2_th_main.c
src/lib/evas/canvas/render2/evas_render2_updates_old.c
src/lib/evas/include/evas_private.h [changed mode: 0755->0644]

index 11109ed..cafe04a 100644 (file)
@@ -4070,8 +4070,8 @@ 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,
+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;
@@ -4081,7 +4081,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)
      {
@@ -4094,7 +4094,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 */
 }
index bc4209e..f486c7b 100644 (file)
@@ -356,8 +356,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;
@@ -366,9 +366,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;
 }
 
index 9f83689..926007a 100644 (file)
@@ -114,9 +114,8 @@ _evas_object_eo_base_constructor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
 }
 
 void
-evas_object_change_reset(Evas_Object *eo_obj)
+evas_object_change_reset(Evas_Object_Protected_Data *obj)
 {
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, MY_CLASS);
    if (!obj) return;
    obj->changed = EINA_FALSE;
    obj->changed_move = EINA_FALSE;
@@ -127,9 +126,8 @@ evas_object_change_reset(Evas_Object *eo_obj)
 }
 
 void
-evas_object_cur_prev(Evas_Object *eo_obj)
+evas_object_cur_prev(Evas_Object_Protected_Data *obj)
 {
-   Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, MY_CLASS);
    if (!obj) return;
    if (!obj->map->prev.valid_map && obj->map->prev.map)
      {
@@ -215,7 +213,7 @@ evas_object_free(Evas_Object *eo_obj, int 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)
@@ -435,9 +433,8 @@ 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 = eo_data_scope_get(eo_obj, MY_CLASS);
    if (!obj) return;
 
    Eina_Rectangle *r;
@@ -541,7 +538,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);
index 406ae56..dc3fa79 100644 (file)
@@ -441,17 +441,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,
+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)
index a22c990..bb5f030 100644 (file)
@@ -336,8 +336,8 @@ 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,
+evas_object_rectangle_render_post(Evas_Object *eo_obj EINA_UNUSED,
+                                 Evas_Object_Protected_Data *obj ,
                                  void *type_private_data EINA_UNUSED)
 {
 
@@ -345,9 +345,9 @@ evas_object_rectangle_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);
 }
 
 static int
index 53e4617..9561919 100644 (file)
@@ -1476,10 +1476,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;
 }
 
index e79ea4c..8759152 100644 (file)
@@ -2230,17 +2230,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
index e363654..021c0f7 100644 (file)
@@ -13645,8 +13645,8 @@ done:
 }
 
 static void
-evas_object_textblock_render_post(Evas_Object *eo_obj,
-                                  Evas_Object_Protected_Data *obj EINA_UNUSED,
+evas_object_textblock_render_post(Evas_Object *eo_obj EINA_UNUSED,
+                                  Evas_Object_Protected_Data *obj ,
                                   void *type_private_data EINA_UNUSED)
 {
    /*   Evas_Textblock_Data *o; */
@@ -13656,9 +13656,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 = (Evas_Textblock_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; */
 }
 
index bc2f9d9..64295ef 100644 (file)
@@ -947,8 +947,8 @@ 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,
+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 */
@@ -956,9 +956,9 @@ evas_object_textgrid_render_post(Evas_Object *eo_obj,
    /* 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;
 
    while (eina_array_count(&o->glyphs_cleanup) > 0)
index 23a5be3..94af6f7 100644 (file)
@@ -533,17 +533,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
old mode 100755 (executable)
new mode 100644 (file)
index 374333a..2c45a32
@@ -712,7 +712,7 @@ _evas_render_phase1_object_process(Evas_Public_Data *e, Evas_Object *eo_obj,
                           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");
                     }
@@ -946,13 +946,13 @@ pending_change(void *data, void *gdata EINA_UNUSED)
         RD(0, "] pending change %i -> 0, pre %i\n", 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) eo_data_unref(eo_obj, obj);
    return obj->changed ? EINA_TRUE : EINA_FALSE;
@@ -1566,7 +1566,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
@@ -1763,7 +1763,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
@@ -2912,7 +2912,7 @@ evas_render_updates_internal(Evas *eo_e,
              RD(0, "] render_post()\n");
              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)
@@ -2956,7 +2956,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);
           }
      }
 
index 72146b4..8c26756 100644 (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,
index b17b934..5ab650b 100644 (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);
 }
old mode 100755 (executable)
new mode 100644 (file)
index 053ab2f..3517d71
@@ -1494,15 +1494,15 @@ extern "C" {
 #endif
 
 Evas_Object *evas_object_new(Evas *e);
-void evas_object_change_reset(Evas_Object *obj);
-void evas_object_cur_prev(Evas_Object *obj);
+void evas_object_change_reset(Evas_Object_Protected_Data *obj);
+void evas_object_cur_prev(Evas_Object_Protected_Data *obj);
 void evas_object_free(Evas_Object *obj, int clean_layer);
 void evas_object_update_bounding_box(Evas_Object *obj, Evas_Object_Protected_Data *pd);
 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);