diff options
author | dormando <dormando@rydia.net> | 2021-05-03 19:08:02 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2021-06-09 16:02:14 -0700 |
commit | 79d996979824ca974188fc589ed52f6fc0b21aeb (patch) | |
tree | 6d832f3d384187284b6f8e1a3974a34e285bf98a /hash.c | |
parent | 4481e4c831dc79058f9ce83046e1d6c53f14b912 (diff) | |
download | memcached-79d996979824ca974188fc589ed52f6fc0b21aeb.tar.gz |
hash: add XXH3 to list of hash algorithms.
needs more testing. in a "pure miss" test to help show hashing overhead,
with four worker threads and large ascii multigets there is a measurable
performance boost for longer keys. Very short keys (10-15 bytes) are
about even.
for 150ish byte keys 12m rps -> 13m rps roughly. Not too bad!
need to test hash table distribution for large sets of keys before
merging. need to consider if worth switching the defaults now or later.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -3,9 +3,15 @@ #include "memcached.h" #include "jenkins_hash.h" #include "murmur3_hash.h" +#define XXH_INLINE_ALL // modifier for xxh3's include below +#include "xxhash.h" hash_func hash; +static uint32_t XXH3_hash(const void *key, size_t length) { + return (uint32_t)XXH3_64bits(key, length); +} + int hash_init(enum hashfunc_type type) { switch(type) { case JENKINS_HASH: @@ -16,6 +22,10 @@ int hash_init(enum hashfunc_type type) { hash = MurmurHash3_x86_32; settings.hash_algorithm = "murmur3"; break; + case XXH3_HASH: + hash = XXH3_hash; + settings.hash_algorithm = "xxh3"; + break; default: return -1; } |