From 1460eebf2abe913df964e031eff081a57f043697 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 13 Dec 2020 21:07:03 +0100 Subject: Use XXH3 for cache, hash table hashing XXH3 is faster than both our CRC32c implementation as well as DJB hash for hash table hashing, so meh, let's switch to it. --- apt-pkg/pkgcachegen.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'apt-pkg/pkgcachegen.h') diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index f5b4c80b3..9a88b45e7 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -29,6 +29,8 @@ #endif #include +#include + class FileFd; class pkgSourceList; class OpProgress; @@ -63,11 +65,7 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ }; struct hash { uint32_t operator()(string_pointer const &that) const { - uint32_t Hash = 5381; - const char * const end = that.data() + that.size; - for (const char *I = that.data(); I != end; ++I) - Hash = 33 * Hash + *I; - return Hash; + return XXH3_64bits(that.data(), that.size) & 0xFFFFFFFF; } }; -- cgit v1.2.3