mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Introduce max_size_degree for HashTableGrower{,WithPrecalculation}
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
42eac6bfbc
commit
634f168a74
@ -230,6 +230,8 @@ struct HashTableGrower
|
||||
/// If collision resolution chains are contiguous, we can implement erase operation by moving the elements.
|
||||
static constexpr auto performs_linear_probing_with_single_step = true;
|
||||
|
||||
static constexpr size_t max_size_degree = 23;
|
||||
|
||||
/// The size of the hash table in the cells.
|
||||
size_t bufSize() const { return 1ULL << size_degree; }
|
||||
|
||||
@ -248,7 +250,7 @@ struct HashTableGrower
|
||||
/// Increase the size of the hash table.
|
||||
void increaseSize()
|
||||
{
|
||||
size_degree += size_degree >= 23 ? 1 : 2;
|
||||
size_degree += size_degree >= max_size_degree ? 1 : 2;
|
||||
}
|
||||
|
||||
/// Set the buffer size by the number of elements in the hash table. Used when deserializing a hash table.
|
||||
@ -280,6 +282,7 @@ class alignas(64) HashTableGrowerWithPrecalculation
|
||||
UInt8 size_degree = initial_size_degree;
|
||||
size_t precalculated_mask = (1ULL << initial_size_degree) - 1;
|
||||
size_t precalculated_max_fill = 1ULL << (initial_size_degree - 1);
|
||||
static constexpr size_t max_size_degree = 23;
|
||||
|
||||
public:
|
||||
UInt8 sizeDegree() const { return size_degree; }
|
||||
@ -309,7 +312,7 @@ public:
|
||||
bool overflow(size_t elems) const { return elems > precalculated_max_fill; }
|
||||
|
||||
/// Increase the size of the hash table.
|
||||
void increaseSize() { increaseSizeDegree(size_degree >= 23 ? 1 : 2); }
|
||||
void increaseSize() { increaseSizeDegree(size_degree >= max_size_degree ? 1 : 2); }
|
||||
|
||||
/// Set the buffer size by the number of elements in the hash table. Used when deserializing a hash table.
|
||||
void set(size_t num_elems)
|
||||
|
Loading…
Reference in New Issue
Block a user