-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use boost d-ary heap for MLD routing #3816
Conversation
include/util/search_heap.hpp
Outdated
BOOST_ASSERT(WasInserted(node)); | ||
auto reference = index.find(node)->second; | ||
reference->weight = weight; | ||
heap.increase(reference->handle, std::make_pair(weight, reference)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it implements a max heap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, greater
instead of less
and increase
instead of decrease
👍 What about our existing heap usages e.g. in the CH code? |
It is possible to use boost heaps, but i don't want to make a performance regression for CH algorithms, as performance depends on memory access patterns. Basically for CH-routing only |
d9f3322
to
66b4a40
Compare
66b4a40
to
ca3a034
Compare
Rebased to the current master and checked performance with #3857 The current implementation of the binary heap is nearly the same as @TheMarex as the 4-ary heap does not bring significant performance improvements, is it still needed? I see only benefit in using generalized library code instead of a custom version I will continue with checking variants for |
@oxidase I suspect the current runtime is dominated by access to the A comparison with Instead of having a separate index for translating global That said this would be a bit of work again and would yield an implementation with more memory usage. I'm fine with tabling again, since this is definitely to the category |
ca3a034
to
1f58fbe
Compare
@TheMarex for the MLD algorithm and germany-latest OSM file
I think it is ready for review, but it brings almost no value, so it is ok to reject the PR as not needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm for merging this, because at least we don't have our own heap implementation anymore.
But we should only use one heap implementation in the code base. So we should remove query_heap.hpp
and port the CH code to use this implementation.
This of course requires a benchmark of CH on old/new just to make sure nothing changed.
a49e4e8
to
054c058
Compare
@TheMarex after lengthy performance investigation i think it is better to close PR without merging, because it is brings no performance improvement but increases memory consumption in places like in master What i can do:
|
054c058
to
87b6e19
Compare
6d63a7d
to
3b8742c
Compare
@TheMarex please could you check the PR? Summary:
I did not change the index storage as it is performance critical and could not find a better solution than the current one with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Issue
For #3764 can be used
boost::heap::d_ary_heap
as a 4-ary heap. The PR addsSearchHeap
that internally usesboost::heap::d_ary_heap
withboost::heap::arity<4>
. In general on a small dataset likebayern-latest
the difference between 2-ary and 4-ary heaps is not statistically relevant, but the difference wrt toBinaryHeap
is for 1000 querieshttp://localhost:5000/route/v1/driving/11.575395,48.137132;9.932966,49.792450
Data summary of MLD routing with
BinaryHeap
(red on histogram) isand for the new
SearchHeap
(blue on histogram) isTasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?