bu5hm4n pushed a commit to branch master.

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

commit e661c4acc3805bc0d2b76b83352d43211e59498c
Author: Marcel Hollerbach <[email protected]>
Date:   Wed Nov 21 20:57:32 2018 +0100

    efl_ui_focus_manager_calc: reduce the amount of list operations
    
    it appears that the calculation of the unordered elements can be done a
    lot easier here, when checking in the initial for loop for the right
    parent safes us two more list walk later on.
    
    Additionally, if all elements in this chain have the right parent, and
    the amount of elements is the same as the parent has, then this list can
    be used as a full replacement.
    
    Differential Revision: https://phab.enlightenment.org/D7330
---
 src/lib/elementary/efl_ui_focus_manager_calc.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c 
b/src/lib/elementary/efl_ui_focus_manager_calc.c
index 01cb8673cc..9dd444dde6 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -683,19 +683,21 @@ _efl_ui_focus_manager_calc_update_order(Eo *obj, 
Efl_Ui_Focus_Manager_Calc_Data
         tmp = eina_hash_find(pd->node_hash, &o);
 
         if (!tmp) continue;
+        if (T(tmp).parent != pnode) continue;
 
         node_order = eina_list_append(node_order, tmp);
      }
-
-   not_ordered = _set_a_without_b(T(pnode).children, node_order);
-   trash = _set_a_without_b(node_order, T(pnode).children);
-   node_order_clean = _set_a_without_b(node_order, trash);
-
-   eina_list_free(node_order);
-   eina_list_free(trash);
-
-   eina_list_free(T(pnode).children);
-   T(pnode).children = eina_list_merge(node_order_clean, not_ordered);
+   if (eina_list_count(node_order) == eina_list_count(T(pnode).children))
+     {
+        eina_list_free(T(pnode).children);
+        T(pnode).children = node_order;
+     }
+   else
+     {
+        not_ordered = _set_a_without_b(T(pnode).children, node_order);
+        eina_list_free(T(pnode).children);
+        T(pnode).children = eina_list_merge(node_order, not_ordered);
+     }
 
    return;
 }

-- 


Reply via email to