aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/edje/edje_util.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-11-13 14:25:10 -0800
committerCedric BAIL <cedric@osg.samsung.com>2017-11-13 14:25:10 -0800
commit6bbcb3cc15297dcd543fefa8789ec6c302edefbf (patch)
tree80fc9720c6d042369e28614affbd287c5f2fe316 /src/lib/edje/edje_util.c
parentedje: cache last string search miss to reduce useless call to eina_str_split_... (diff)
downloadefl-6bbcb3cc15297dcd543fefa8789ec6c302edefbf.tar.gz
edje: last improvement of _edje_hash_find_helper speed by reducing call to eina split function.
Diffstat (limited to '')
-rw-r--r--src/lib/edje/edje_util.c9
1 files changed, 9 insertions, 0 deletions
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))
{