You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Alternatives are very slow for LM/AStar+turn costs #2566
So alternatives take 80 times longer than a single route for node-based. This seems very slow, but at least it still takes less than a second. But for edge-based it is even worse where the slow down is x360 and the response takes so long that its almost not useful anymore.
This is not just special for this route, I just gave an example. I actually saw routes that took tens of seconds, and I did not even try a larger map. Disabling LM makes it even slower.
Using the approach taken by @michaz in #2092 the query time for edge-based alternative seems to go down from ~9s to ~5s. For node-based it goes down a bit, too: ~700ms instead of 800ms. Even the single routes seem to be a bit faster. This was just a quick manual test, let's see what our automatic performance measurements say: 19e2e16
I can vouch for Java Mission Control paired with -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints for getting a good grasp about where the bottleneck is :)
I am answering here as this is about speeding up alternative routes:
Thanks I will try. I am using the YourKit Profiler, usually. But in my experience this does not help much and the real issues are typically caused by the algorithms (i.e. normally something is called too often rather than some method is slow). Or I still haven't really figured out how to use it :) In the case of AlternativeRoute I am pretty sure the following code takes very long, especially for large search trees:
But I did not really look at the alternative route algorithm to figure out if this can be avoided without making the quality of alternative routes worse.
Yes, I like the flame view, too. YourKit has it as well. But often I saw cases where something looks like a bottleneck there, but in reality it wasn't. Overall I feel like I spent a lot of time looking at the profiler, but rarely it helped me finding important bottlenecks and a lot more often it was improving the algorithm that lead to significant speed ups. But maybe I'm still just doing it wrong.
In other news: This: 19e2e16 is definitely an improvement, especially for edge-based routing without CH. And in this case the PriorityQueue#remove() call actually shows up in the profiler, too :) I'll open a separate PR for this soon -> #2571.
Activity
easbar commentedon Apr 27, 2022
Using the approach taken by @michaz in #2092 the query time for edge-based alternative seems to go down from ~9s to ~5s. For node-based it goes down a bit, too: ~700ms instead of 800ms. Even the single routes seem to be a bit faster. This was just a quick manual test, let's see what our automatic performance measurements say: 19e2e16
easbar commentedon Apr 27, 2022
@otbutz in #2567 you wrote:
I am answering here as this is about speeding up alternative routes:
Thanks I will try. I am using the YourKit Profiler, usually. But in my experience this does not help much and the real issues are typically caused by the algorithms (i.e. normally something is called too often rather than some method is slow). Or I still haven't really figured out how to use it :) In the case of AlternativeRoute I am pretty sure the following code takes very long, especially for large search trees:
graphhopper/core/src/main/java/com/graphhopper/routing/AlternativeRoute.java
Lines 321 to 326 in 47febfc
But I did not really look at the alternative route algorithm to figure out if this can be avoided without making the quality of alternative routes worse.
otbutz commentedon Apr 27, 2022
The flame view is immensely helpful IMHO.
https://www.youtube.com/watch?v=vVh_z34Gtn8
easbar commentedon Apr 28, 2022
Yes, I like the flame view, too. YourKit has it as well. But often I saw cases where something looks like a bottleneck there, but in reality it wasn't. Overall I feel like I spent a lot of time looking at the profiler, but rarely it helped me finding important bottlenecks and a lot more often it was improving the algorithm that lead to significant speed ups. But maybe I'm still just doing it wrong.
In other news: This: 19e2e16 is definitely an improvement, especially for edge-based routing without CH. And in this case the
PriorityQueue#remove()call actually shows up in the profiler, too :) I'll open a separate PR for this soon -> #2571.michaz commentedon May 17, 2022
I would just put in a comment that this is code that exists for completeness (alternative routes without CH), but doesn't claim to be practical.
No need to worry about its performance at all.
easbar commentedon May 27, 2022
Alternatives with CH are faster, but alternatives with LM/AStar are even slower since #2567. See this list of potential optimizations: #2567 (comment)