Common: Replace MurmurHash3 with CityHash64

CityHash64 is faster than Murmur3 at all sizes, but especially for short
keys.
This commit is contained in:
Yuri Kunde Schlesner
2018-01-15 01:03:08 -08:00
parent 79dca3d67a
commit 7f77820460
5 changed files with 766 additions and 147 deletions

View File

@@ -5,12 +5,11 @@
#pragma once
#include <cstddef>
#include "common/cityhash.h"
#include "common/common_types.h"
namespace Common {
void MurmurHash3_128(const void* key, size_t len, u32 seed, void* out);
/**
* Computes a 64-bit hash over the specified block of data
* @param data Block of data to compute hash over
@@ -18,9 +17,7 @@ void MurmurHash3_128(const void* key, size_t len, u32 seed, void* out);
* @returns 64-bit hash value that was computed over the data block
*/
static inline u64 ComputeHash64(const void* data, size_t len) {
u64 res[2];
MurmurHash3_128(data, len, 0, res);
return res[0];
return CityHash64(static_cast<const char*>(data), len);
}
} // namespace Common