eina: increase hash matching inside of Eina_Hash.
authorCedric Bail <cedric.bail@samsung.com>
Wed, 4 Dec 2013 09:29:07 +0000 (18:29 +0900)
committerCedric Bail <cedric.bail@samsung.com>
Wed, 4 Dec 2013 09:33:05 +0000 (18:33 +0900)
This is the correct implementation of the idea developped in Lucas De Marchi's blog :
http://www.politreco.com/2013/09/optimizing-hash-table-with-kmod-as-testbed/

This give an interesting +15% for all Eina_Hash user whatever hash function they use. The inlined
djb2 is still the fastest one and all other give very close result. It does increase memory foot
print, but as much as the previous way of doing it.

src/lib/eina/eina_hash.c

index dab865e..274d3e8 100644 (file)
@@ -64,7 +64,7 @@
 #define EINA_HASH_BUCKET_SIZE       8
 #define EINA_HASH_SMALL_BUCKET_SIZE 5
 
-#define EINA_HASH_RBTREE_MASK       0xFFF
+#define EINA_HASH_RBTREE_MASK       0xFFFFFF
 
 typedef struct _Eina_Hash_Head         Eina_Hash_Head;
 typedef struct _Eina_Hash_Element      Eina_Hash_Element;