diff --git a/benchmark/hashmap_build.cpp b/benchmark/hashmap_build.cpp index 4f8a3daf6..7d63acb71 100644 --- a/benchmark/hashmap_build.cpp +++ b/benchmark/hashmap_build.cpp @@ -5,8 +5,6 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include "td/utils/FlatHashMap.h" -#include "td/utils/FlatHashMapChunks.h" -#include "td/utils/FlatHashMapLinear.h" #ifdef SCOPE_EXIT #undef SCOPE_EXIT diff --git a/benchmark/hashset_memory.cpp b/benchmark/hashset_memory.cpp index 3ed7e6393..aacd18247 100644 --- a/benchmark/hashset_memory.cpp +++ b/benchmark/hashset_memory.cpp @@ -11,7 +11,7 @@ #include "td/utils/common.h" #include "td/utils/FlatHashMap.h" #include "td/utils/FlatHashMapChunks.h" -#include "td/utils/FlatHashMapLinear.h" +#include "td/utils/FlatHashTable.h" #include "td/utils/logging.h" #include "td/utils/misc.h" #include "td/utils/port/Stat.h" @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -164,8 +165,11 @@ void print_memory_stats(td::Slice name) { } } +template , class EqT = std::equal_to> +using FlatHashMapImpl = td::FlatHashTable, HashT, EqT>; + #define FOR_EACH_TABLE(F) \ - F(td::FlatHashMapImpl) \ + F(FlatHashMapImpl) \ F(folly::F14FastMap) \ F(absl::flat_hash_map) \ F(std::unordered_map) \ diff --git a/tdutils/CMakeLists.txt b/tdutils/CMakeLists.txt index e5083f1ed..f8a69ecad 100644 --- a/tdutils/CMakeLists.txt +++ b/tdutils/CMakeLists.txt @@ -207,7 +207,7 @@ set(TDUTILS_SOURCE td/utils/find_boundary.h td/utils/FlatHashMap.h td/utils/FlatHashMapChunks.h - td/utils/FlatHashMapLinear.h + td/utils/FlatHashTable.h td/utils/FloodControlFast.h td/utils/FloodControlStrict.h td/utils/format.h diff --git a/tdutils/td/utils/FlatHashMap.h b/tdutils/td/utils/FlatHashMap.h index a271a5222..d4d3fc3dd 100644 --- a/tdutils/td/utils/FlatHashMap.h +++ b/tdutils/td/utils/FlatHashMap.h @@ -7,7 +7,9 @@ #pragma once //#include "td/utils/FlatHashMapChunks.h" -//#include "td/utils/FlatHashMapLinear.h" +//#include "td/utils/FlatHashTable.h" +//#include "td/utils/MapNode.h" +//#include "td/utils/SetNode.h" #include #include @@ -16,12 +18,12 @@ namespace td { template , class EqT = std::equal_to> -//using FlatHashMap = FlatHashMapImpl; +//using FlatHashMap = FlatHashTable, HashT, EqT>; //using FlatHashMap = FlatHashMapChunks; using FlatHashMap = std::unordered_map; template , class EqT = std::equal_to> -//using FlatHashSet = FlatHashSetImpl; +//using FlatHashSet = FlatHashTable, HashT, EqT>; //using FlatHashSet = FlatHashSetChunks; using FlatHashSet = std::unordered_set; diff --git a/tdutils/td/utils/FlatHashMapLinear.h b/tdutils/td/utils/FlatHashTable.h similarity index 97% rename from tdutils/td/utils/FlatHashMapLinear.h rename to tdutils/td/utils/FlatHashTable.h index 0e0fae8cc..2aaae21a4 100644 --- a/tdutils/td/utils/FlatHashMapLinear.h +++ b/tdutils/td/utils/FlatHashTable.h @@ -503,10 +503,4 @@ class FlatHashTable { } }; -template , class EqT = std::equal_to> -using FlatHashMapImpl = FlatHashTable, HashT, EqT>; - -template , class EqT = std::equal_to> -using FlatHashSetImpl = FlatHashTable, HashT, EqT>; - } // namespace td diff --git a/tdutils/test/HashSet.cpp b/tdutils/test/HashSet.cpp index 06859946e..aa3a28ed5 100644 --- a/tdutils/test/HashSet.cpp +++ b/tdutils/test/HashSet.cpp @@ -8,7 +8,6 @@ #include "td/utils/common.h" #include "td/utils/FlatHashMap.h" #include "td/utils/FlatHashMapChunks.h" -#include "td/utils/FlatHashMapLinear.h" #include "td/utils/logging.h" #include "td/utils/Random.h" #include "td/utils/Slice.h" diff --git a/tdutils/test/hashset_benchmark.cpp b/tdutils/test/hashset_benchmark.cpp index 41e83d7a2..d0eb20e2e 100644 --- a/tdutils/test/hashset_benchmark.cpp +++ b/tdutils/test/hashset_benchmark.cpp @@ -8,10 +8,11 @@ #include "td/utils/common.h" #include "td/utils/FlatHashMap.h" #include "td/utils/FlatHashMapChunks.h" -#include "td/utils/FlatHashMapLinear.h" +#include "td/utils/FlatHashTable.h" #include "td/utils/format.h" #include "td/utils/Hash.h" #include "td/utils/logging.h" +#include "td/utils/MapNode.h" #include "td/utils/Random.h" #include "td/utils/Slice.h" #include "td/utils/Span.h" @@ -27,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -558,8 +560,11 @@ BENCHMARK_TEMPLATE(BM_mask, td::MaskNeon); BENCHMARK_TEMPLATE(BM_mask, td::MaskSse2); #endif +template , class EqT = std::equal_to> +using FlatHashMapImpl = td::FlatHashTable, HashT, EqT>; + #define FOR_EACH_TABLE(F) \ - F(td::FlatHashMapImpl) \ + F(FlatHashMapImpl) \ F(td::FlatHashMapChunks) \ F(folly::F14FastMap) \ F(absl::flat_hash_map) \