From 1b94d90d53dd71457cd92575d9f29c58d76eef75 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Fri, 9 Aug 2019 14:02:24 +0900 Subject: [PATCH] edje: optimize color_class_recursive_find_helper() function Summary: If the color_class is not overridden by the object level the hash will be empty but still we do the expensive call to _edje_hash_find_helper() find the color_class in an empty hash. by checking if the hash is empty and returning early we save lot of unnecessary hash computaion and lookup. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9532 --- src/lib/edje/edje_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 20aeec4a53..4e3cdba15d 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -5722,6 +5722,8 @@ _edje_color_class_recursive_find_helper(const Edje *ed, Eina_Hash *hash, const c Edje_Color_Tree_Node *ctn = NULL; const char *parent; + if (!eina_hash_population(hash)) return NULL; + cc = _edje_hash_find_helper(hash, color_class); if (cc) return cc; else if (ed->file)