forked from enlightenment/efl
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:
parent
41c28c3deb
commit
ff845b0a7c
|
@ -489,9 +489,13 @@ _eina_string_key_length(const char *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_eina_string_key_cmp(const char *key1, EINA_UNUSED int key1_length,
|
_eina_string_key_cmp(const char *key1, int key1_length,
|
||||||
const char *key2, EINA_UNUSED int key2_length)
|
const char *key2, int key2_length)
|
||||||
{
|
{
|
||||||
|
int delta;
|
||||||
|
|
||||||
|
delta = key1_length - key2_length;
|
||||||
|
if (delta) return delta;
|
||||||
return strcmp(key1, key2);
|
return strcmp(key1, key2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue