Use ArrayStorage for boundary nodes to optimize MLD
For the MLD algorithm we can partition the NodeID range into boundary and non-boundary nodes. Since there are only we boundary nodes we can use the ArrayStorage for those yielding much faster query times.
This commit is contained in:
committed by
Patrick Niklaus
parent
7edf0f218c
commit
bf2b45120a
@@ -46,6 +46,25 @@ unsigned getMedianSampleTime(const std::vector<unsigned> ×tamps)
|
||||
std::nth_element(first_elem, median, sample_times.end());
|
||||
return *median;
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
inline void initializeHeap(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const DataFacade<Algorithm> &facade)
|
||||
{
|
||||
|
||||
const auto nodes_number = facade.GetNumberOfNodes();
|
||||
engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void initializeHeap<mld::Algorithm>(SearchEngineData<mld::Algorithm> &engine_working_data,
|
||||
const DataFacade<mld::Algorithm> &facade)
|
||||
{
|
||||
|
||||
const auto nodes_number = facade.GetNumberOfNodes();
|
||||
const auto border_nodes_number = facade.GetMaxBorderNodeID() + 1;
|
||||
engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number, border_nodes_number);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Algorithm>
|
||||
@@ -131,9 +150,7 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
|
||||
return sub_matchings;
|
||||
}
|
||||
|
||||
const auto nodes_number = facade.GetNumberOfNodes();
|
||||
engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number);
|
||||
|
||||
initializeHeap(engine_working_data, facade);
|
||||
auto &forward_heap = *engine_working_data.forward_heap_1;
|
||||
auto &reverse_heap = *engine_working_data.reverse_heap_1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user