From 5c5d19e76f5f62424d4937446c2744f456b0fa4e Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 22 Sep 2022 07:13:17 +0300 Subject: [PATCH] Increase 8 times number of WaitFreeMap storages. --- tdutils/td/utils/WaitFreeHashMap.h | 5 +++-- tdutils/td/utils/WaitFreeHashSet.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tdutils/td/utils/WaitFreeHashMap.h b/tdutils/td/utils/WaitFreeHashMap.h index 6d55e9150..f38f01fe3 100644 --- a/tdutils/td/utils/WaitFreeHashMap.h +++ b/tdutils/td/utils/WaitFreeHashMap.h @@ -17,9 +17,10 @@ namespace td { template , class EqT = std::equal_to> class WaitFreeHashMap { using Storage = FlatHashMap; - static constexpr size_t MAX_STORAGE_COUNT = 256; + static constexpr size_t MAX_STORAGE_COUNT = 1 << 11; static_assert((MAX_STORAGE_COUNT & (MAX_STORAGE_COUNT - 1)) == 0, ""); - static constexpr size_t MAX_STORAGE_SIZE = MAX_STORAGE_COUNT * MAX_STORAGE_COUNT / 2; + static constexpr size_t MAX_STORAGE_SIZE = 1 << 17; + static_assert((MAX_STORAGE_SIZE & (MAX_STORAGE_SIZE - 1)) == 0, ""); Storage default_map_; struct WaitFreeStorage { diff --git a/tdutils/td/utils/WaitFreeHashSet.h b/tdutils/td/utils/WaitFreeHashSet.h index e2cec3777..4341e73a0 100644 --- a/tdutils/td/utils/WaitFreeHashSet.h +++ b/tdutils/td/utils/WaitFreeHashSet.h @@ -17,9 +17,10 @@ namespace td { template , class EqT = std::equal_to> class WaitFreeHashSet { using Storage = FlatHashSet; - static constexpr size_t MAX_STORAGE_COUNT = 256; + static constexpr size_t MAX_STORAGE_COUNT = 1 << 11; static_assert((MAX_STORAGE_COUNT & (MAX_STORAGE_COUNT - 1)) == 0, ""); - static constexpr size_t MAX_STORAGE_SIZE = MAX_STORAGE_COUNT * MAX_STORAGE_COUNT / 2; + static constexpr size_t MAX_STORAGE_SIZE = 1 << 17; + static_assert((MAX_STORAGE_SIZE & (MAX_STORAGE_SIZE - 1)) == 0, ""); Storage default_set_; struct WaitFreeStorage {