Skip to content

Commit 90768bd

Browse files
Try to use boost::fast_pool_allocator in QueryHeap
1 parent 89435aa commit 90768bd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

include/util/query_heap.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <boost/heap/d_ary_heap.hpp>
66

77
#include <algorithm>
8+
#include <boost/pool/pool_alloc.hpp>
89
#include <cstdint>
910
#include <limits>
1011
#include <map>
@@ -121,7 +122,16 @@ template <typename NodeID, typename Key> class UnorderedMapStorage
121122
void Clear() { nodes.clear(); }
122123

123124
private:
124-
std::unordered_map<NodeID, Key> nodes;
125+
template <typename T>
126+
using PoolAllocator = boost::fast_pool_allocator<T,
127+
boost::default_user_allocator_new_delete,
128+
boost::details::pool::null_mutex>;
129+
130+
template <typename K, typename V>
131+
using UnorderedMap = std::
132+
unordered_map<K, V, std::hash<K>, std::equal_to<K>, PoolAllocator<std::pair<const K, V>>>;
133+
134+
UnorderedMap<NodeID, Key> nodes;
125135
};
126136

127137
template <typename NodeID,

0 commit comments

Comments
 (0)