Optimize FlatHashTable::emplace.

This commit is contained in:
levlam 2022-03-14 13:25:41 +03:00
parent 057b2d1e05
commit cd21f58e7d

View File

@ -478,10 +478,8 @@ class FlatHashTable {
} }
void try_grow() { void try_grow() {
if (unlikely(nodes_ == nullptr)) { if (unlikely(used_node_count_ * 5 >= bucket_count_mask_ * 3)) {
resize(8); resize(2 * bucket_count_mask_ + 2 + 6 * (bucket_count_mask_ == 0));
} else if (unlikely(used_node_count_ * 5 > bucket_count_mask_ * 3)) {
resize(2 * bucket_count_mask_ + 2);
} }
invalidate_iterators(); invalidate_iterators();
} }