mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🐎 made phmap use xxhash as hashing
This commit is contained in:
parent
58c16457cf
commit
c13164dde8
2 changed files with 14 additions and 1 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
12
include/xxhash_strfunctor.hpp
Normal file
12
include/xxhash_strfunctor.hpp
Normal 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());
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue