diff --git a/include/bank.h b/include/bank.h index 9f4ca41..a4ec78e 100644 --- a/include/bank.h +++ b/include/bank.h @@ -4,6 +4,7 @@ #include #include #include +#include "xxhash_strfunctor.hpp" #include "user.h" #if CONSERVATIVE_DISK_SAVE && MAX_LOG_SIZE < 0 @@ -16,7 +17,7 @@ class Bank { phmap::parallel_flat_hash_map< std::string, User, - phmap::priv::hash_default_hash, + xxHashStringGen, phmap::priv::hash_default_eq, phmap::priv::Allocator>, 4UL, diff --git a/include/xxhash_strfunctor.hpp b/include/xxhash_strfunctor.hpp new file mode 100644 index 0000000..cddbe3f --- /dev/null +++ b/include/xxhash_strfunctor.hpp @@ -0,0 +1,12 @@ +#pragma once +#include +#include +#include + +struct xxHashStringGen +{ + inline uint64_t operator()(const std::string &str) const + { + return XXH3_64bits(str.data(), str.size()); + } +}; \ No newline at end of file