cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e76349cd41d92b5fcf189d21a79c8d40dfeb9604

commit e76349cd41d92b5fcf189d21a79c8d40dfeb9604
Author: Marcel Hollerbach <m...@marcel-hollerbach.de>
Date:   Mon Jul 15 21:00:56 2019 +0200

    efl_ui_widget: performance optimize deletion
    
    when a logic parent does not have any widgets left, the parent needs to
    be reevaluated. However, this only has to happen when there is a change
    in state (eg. from 0 -> N or from N -> 0). Every other call can be
    safed. This commit introduces this checking, and safes up performance.
    
    Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
    Differential Revision: https://phab.enlightenment.org/D9323
---
 src/lib/elementary/efl_ui_widget.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/lib/elementary/efl_ui_widget.c 
b/src/lib/elementary/efl_ui_widget.c
index 2ed0f9b379..a8d8987a6e 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -490,6 +490,10 @@ _logical_parent_eval(Eo *obj EINA_UNUSED, 
Elm_Widget_Smart_Data *pd, Eina_Bool s
                {
                   ELM_WIDGET_DATA_GET_OR_RETURN(pd->logical.parent, 
logical_wd, NULL);
                   logical_wd->logical.child_count --;
+                  if (logical_wd->logical.child_count == 0)
+                    {
+                      *state_change_to_parent = EINA_TRUE;
+                    }
                }
              old = pd->logical.parent;
              efl_weak_unref(&pd->logical.parent);
@@ -525,19 +529,23 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
 
    old_parent = _logical_parent_eval(obj, pd, should, &state_change_to_parent);
 
-   if (efl_isa(old_parent, EFL_UI_WIDGET_CLASS))
+   if (state_change_to_parent)
      {
-        //emit signal and focus eval old and new
-        ELM_WIDGET_DATA_GET(old_parent, old_pd);
-        _full_eval(old_parent, old_pd);
-     }
+        if (efl_isa(old_parent, EFL_UI_WIDGET_CLASS))
+          {
+             //emit signal and focus eval old and new
+             ELM_WIDGET_DATA_GET(old_parent, old_pd);
+             _full_eval(old_parent, old_pd);
+          }
 
-   if (state_change_to_parent && efl_isa(pd->logical.parent, 
EFL_UI_WIDGET_CLASS))
-     {
-        ELM_WIDGET_DATA_GET(pd->logical.parent, new_pd);
-        _full_eval(pd->logical.parent, new_pd);
+        if (efl_isa(pd->logical.parent, EFL_UI_WIDGET_CLASS))
+          {
+             ELM_WIDGET_DATA_GET(pd->logical.parent, new_pd);
+             _full_eval(pd->logical.parent, new_pd);
+          }
      }
 
+
    _focus_manager_eval(obj, pd, want_full, should);
 
    old_registered_parent = pd->focus.parent;

-- 


Reply via email to