Skip to content

Commit 53032e5

Browse files
wip
1 parent 233a756 commit 53032e5

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

include/contractor/contractor_heap.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ using ContractorHeap = util::QueryHeap<NodeID,
2020
NodeID,
2121
EdgeWeight,
2222
ContractorHeapData,
23-
util::XORFastHashStorage<NodeID, NodeID>>;
23+
util::XORFastHashStorage<NodeID, NodeID>,
24+
false>;
2425

2526
} // namespace osrm::contractor
2627

include/customizer/cell_customizer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CellCustomizer
2525

2626
public:
2727
using Heap =
28-
util::QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>;
28+
util::QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>, false>;
2929
using HeapPtr = tbb::enumerable_thread_specific<Heap>;
3030

3131
CellCustomizer(const partitioner::MultiLevelPartition &partition) : partition(partition) {}

include/util/query_heap.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ template <typename NodeID, typename Key> class UnorderedMapStorage
124124
private:
125125
template <typename K, typename V>
126126
using UnorderedMap = std::
127-
unordered_map<K, V, std::hash<K>, std::equal_to<K>, PoolAllocator<std::pair<const K, V>>>;
127+
unordered_map<K, V/*, std::hash<K>, std::equal_to<K>, PoolAllocator<std::pair<const K, V>>*/>;
128128

129129
UnorderedMap<NodeID, Key> nodes;
130130
};
@@ -241,7 +241,8 @@ template <typename NodeID,
241241
typename Key,
242242
typename Weight,
243243
typename Data,
244-
typename IndexStorage = ArrayStorage<NodeID, NodeID>>
244+
typename IndexStorage = ArrayStorage<NodeID, NodeID>,
245+
bool ThreadLocal = true>
245246
class QueryHeap
246247
{
247248
private:
@@ -259,11 +260,17 @@ class QueryHeap
259260
return weight > other.weight;
260261
}
261262
};
263+
264+
using AllocatorType = typename std::conditional<ThreadLocal,
265+
PoolAllocator<HeapData>,
266+
std::allocator<HeapData>>::type;
267+
268+
262269
using HeapContainer = boost::heap::d_ary_heap<HeapData,
263270
boost::heap::arity<4>,
264271
boost::heap::mutable_<true>,
265272
boost::heap::compare<std::greater<HeapData>>,
266-
boost::heap::allocator<PoolAllocator<HeapData>>>;
273+
boost::heap::allocator<AllocatorType>>;
267274
using HeapHandle = typename HeapContainer::handle_type;
268275

269276
public:

0 commit comments

Comments
 (0)