HDK
|
#include <robin_growth_policy.h>
Public Member Functions | |
prime_growth_policy (std::size_t &min_bucket_count_in_out) | |
std::size_t | bucket_for_hash (std::size_t hash) const noexcept |
std::size_t | next_bucket_count () const |
std::size_t | max_bucket_count () const |
void | clear () noexcept |
Grow the hash table by using prime numbers as bucket count. Slower than tsl::rh::power_of_two_growth_policy in general but will probably distribute the values around better in the buckets with a poor hash function.
To allow the compiler to optimize the modulo operation, a lookup table is used with constant primes numbers.
With a switch the code would look like:
Due to the constant variable in the modulo the compiler is able to optimize the operation by a series of multiplications, substractions and shifts.
The 'hash % 5' could become something like 'hash - (hash * 0xCCCCCCCD) >> 34)
Definition at line 364 of file robin_growth_policy.h.
|
inlineexplicit |
Definition at line 366 of file robin_growth_policy.h.
|
inlinenoexcept |
Definition at line 383 of file robin_growth_policy.h.
Definition at line 398 of file robin_growth_policy.h.
|
inline |
Definition at line 396 of file robin_growth_policy.h.
|
inline |
Definition at line 387 of file robin_growth_policy.h.