🐎 made phmap use xxhash as hashing

This commit is contained in:
EntireTwix 2021-06-29 15:06:18 -07:00
parent 58c16457cf
commit c13164dde8
2 changed files with 14 additions and 1 deletions

View file

@ -4,6 +4,7 @@
#include <shared_mutex> #include <shared_mutex>
#include <drogon/HttpTypes.h> #include <drogon/HttpTypes.h>
#include <parallel-hashmap/parallel_hashmap/phmap.h> #include <parallel-hashmap/parallel_hashmap/phmap.h>
#include "xxhash_strfunctor.hpp"
#include "user.h" #include "user.h"
#if CONSERVATIVE_DISK_SAVE && MAX_LOG_SIZE < 0 #if CONSERVATIVE_DISK_SAVE && MAX_LOG_SIZE < 0
@ -16,7 +17,7 @@ class Bank
{ {
phmap::parallel_flat_hash_map< phmap::parallel_flat_hash_map<
std::string, User, std::string, User,
phmap::priv::hash_default_hash<std::string>, xxHashStringGen,
phmap::priv::hash_default_eq<std::string>, phmap::priv::hash_default_eq<std::string>,
phmap::priv::Allocator<phmap::priv::Pair<const std::string, User>>, phmap::priv::Allocator<phmap::priv::Pair<const std::string, User>>,
4UL, 4UL,

View file

@ -0,0 +1,12 @@
#pragma once
#include <type_traits>
#include <string>
#include <xxhash.h>
struct xxHashStringGen
{
inline uint64_t operator()(const std::string &str) const
{
return XXH3_64bits(str.data(), str.size());
}
};