eina: improve cmp function of eina_hash string related hash.

For strings, we already know the length, so let's just not call the
heavy strcmp if the length is not already the same. Get some easy
speedup here.
This commit is contained in:
Cedric Bail 2013-12-04 19:05:03 +09:00
parent 41c28c3deb
commit ff845b0a7c
1 changed files with 6 additions and 2 deletions

View File

@ -489,9 +489,13 @@ _eina_string_key_length(const char *key)
}
static int
_eina_string_key_cmp(const char *key1, EINA_UNUSED int key1_length,
const char *key2, EINA_UNUSED int key2_length)
_eina_string_key_cmp(const char *key1, int key1_length,
const char *key2, int key2_length)
{
int delta;
delta = key1_length - key2_length;
if (delta) return delta;
return strcmp(key1, key2);
}