hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=da39f53b95c9bae298fb0145f152c2d81b5ebe31
commit da39f53b95c9bae298fb0145f152c2d81b5ebe31 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Fri Aug 9 14:00:03 2019 +0900 eina/hash: optimize eina_hash_find() when hash is empty. Summary: Check if hash is empty before computing the hash key and look inside the hash to find data. Note: could have called the eina_hash_population() api but didn't because of extra function call. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9531 --- src/lib/eina/eina_hash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/eina/eina_hash.c b/src/lib/eina/eina_hash.c index 92c37e1968..64d298b513 100644 --- a/src/lib/eina/eina_hash.c +++ b/src/lib/eina/eina_hash.c @@ -1077,6 +1077,9 @@ eina_hash_find(const Eina_Hash *hash, const void *key) EINA_SAFETY_ON_NULL_RETURN_VAL(key, NULL); EINA_MAGIC_CHECK_HASH(hash); + if (hash->population == 0) + return NULL; + _eina_hash_compute(hash, key, &key_length, &key_hash); return eina_hash_find_by_hash(hash, key, key_length, key_hash); --