Move FlatHashTable implementation to FlatHashTable.h.
This commit is contained in:
parent
15520c5ddd
commit
07bb129653
@ -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
|
||||
|
@ -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 <absl/container/flat_hash_map.h>
|
||||
#include <array>
|
||||
#include <folly/container/F14Map.h>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
@ -164,8 +165,11 @@ void print_memory_stats(td::Slice name) {
|
||||
}
|
||||
}
|
||||
|
||||
template <class KeyT, class ValueT, class HashT = std::hash<KeyT>, class EqT = std::equal_to<KeyT>>
|
||||
using FlatHashMapImpl = td::FlatHashTable<td::MapNode<KeyT, ValueT>, HashT, EqT>;
|
||||
|
||||
#define FOR_EACH_TABLE(F) \
|
||||
F(td::FlatHashMapImpl) \
|
||||
F(FlatHashMapImpl) \
|
||||
F(folly::F14FastMap) \
|
||||
F(absl::flat_hash_map) \
|
||||
F(std::unordered_map) \
|
||||
|
@ -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
|
||||
|
@ -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 <functional>
|
||||
#include <unordered_map>
|
||||
@ -16,12 +18,12 @@
|
||||
namespace td {
|
||||
|
||||
template <class KeyT, class ValueT, class HashT = std::hash<KeyT>, class EqT = std::equal_to<KeyT>>
|
||||
//using FlatHashMap = FlatHashMapImpl<KeyT, ValueT, HashT, EqT>;
|
||||
//using FlatHashMap = FlatHashTable<MapNode<KeyT, ValueT>, HashT, EqT>;
|
||||
//using FlatHashMap = FlatHashMapChunks<KeyT, ValueT, HashT, EqT>;
|
||||
using FlatHashMap = std::unordered_map<KeyT, ValueT, HashT, EqT>;
|
||||
|
||||
template <class KeyT, class HashT = std::hash<KeyT>, class EqT = std::equal_to<KeyT>>
|
||||
//using FlatHashSet = FlatHashSetImpl<KeyT, HashT, EqT>;
|
||||
//using FlatHashSet = FlatHashTable<SetNode<KeyT>, HashT, EqT>;
|
||||
//using FlatHashSet = FlatHashSetChunks<KeyT, HashT, EqT>;
|
||||
using FlatHashSet = std::unordered_set<KeyT, HashT, EqT>;
|
||||
|
||||
|
@ -503,10 +503,4 @@ class FlatHashTable {
|
||||
}
|
||||
};
|
||||
|
||||
template <class KeyT, class ValueT, class HashT = std::hash<KeyT>, class EqT = std::equal_to<KeyT>>
|
||||
using FlatHashMapImpl = FlatHashTable<MapNode<KeyT, ValueT>, HashT, EqT>;
|
||||
|
||||
template <class KeyT, class HashT = std::hash<KeyT>, class EqT = std::equal_to<KeyT>>
|
||||
using FlatHashSetImpl = FlatHashTable<SetNode<KeyT>, HashT, EqT>;
|
||||
|
||||
} // namespace td
|
@ -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"
|
||||
|
@ -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 <algorithm>
|
||||
#include <benchmark/benchmark.h>
|
||||
#include <folly/container/F14Map.h>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <random>
|
||||
#include <unordered_map>
|
||||
@ -558,8 +560,11 @@ BENCHMARK_TEMPLATE(BM_mask, td::MaskNeon);
|
||||
BENCHMARK_TEMPLATE(BM_mask, td::MaskSse2);
|
||||
#endif
|
||||
|
||||
template <class KeyT, class ValueT, class HashT = std::hash<KeyT>, class EqT = std::equal_to<KeyT>>
|
||||
using FlatHashMapImpl = td::FlatHashTable<td::MapNode<KeyT, ValueT>, HashT, EqT>;
|
||||
|
||||
#define FOR_EACH_TABLE(F) \
|
||||
F(td::FlatHashMapImpl) \
|
||||
F(FlatHashMapImpl) \
|
||||
F(td::FlatHashMapChunks) \
|
||||
F(folly::F14FastMap) \
|
||||
F(absl::flat_hash_map) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user