cedric pushed a commit to branch master.

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

commit 6bbcb3cc15297dcd543fefa8789ec6c302edefbf
Author: Cedric BAIL <[email protected]>
Date:   Mon Nov 13 14:25:10 2017 -0800

    edje: last improvement of _edje_hash_find_helper speed by reducing call to 
eina split function.
---
 src/lib/edje/edje_util.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index e37a8d43f7..03f38abfcc 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -5354,6 +5354,15 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char 
*key)
    if (remember_key == key)
      return NULL;
 
+   // It is usually faster to walk the string once to check
+   // if there will be any tokens to process, that to allocate
+   // an array, copy one token, and then just free it.
+   if (strchr(key, '/') == NULL)
+     {
+        remember_key = key;
+        return NULL;
+     }
+
    tokens = eina_str_split_full(key, "/", 0, &tokens_count);
    if ((tokens) && (tokens_count > 1))
      {

-- 


Reply via email to