Replace FNV-1a hash by faster and better MurmurHash64A.

Replace FNV-1a hash algorithm by public domain MurmurHash64A, by Austin
Appleby, which is faster and has better hash properties. This is also
the default hash algorithm of GNU C++ Standard Library.

Startup time on a given system (with x86-64-avx2 binaries) reduces from
378ms to 332ms (46ms faster). Hashing of the largest data input (46.1MB)
goes from 44.2ms to 6.2ms, so about 7x faster.

No functional change

closes https://github.com/official-stockfish/Stockfish/pull/6579

Bench: 2570943
This commit is contained in:
Dieter Dobbelaere
2026-02-08 15:22:21 +01:00
committed by Disservin
parent 005f0f9b2a
commit 6b6334ce8e
2 changed files with 40 additions and 8 deletions
+1 -8
View File
@@ -306,14 +306,7 @@ inline uint64_t mul_hi64(uint64_t a, uint64_t b) {
#endif
}
inline std::uint64_t hash_bytes(const char* data, std::size_t size) {
// FNV-1a 64-bit
const char* p = data;
std::uint64_t h = 14695981039346656037ull;
for (std::size_t i = 0; i < size; ++i)
h = (h ^ p[i]) * 1099511628211ull;
return h;
}
uint64_t hash_bytes(const char*, size_t);
template<typename T>
inline std::size_t get_raw_data_hash(const T& value) {