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
SPT with finite, non-zero turn costs much slower #2086
For routing with turn restrictions enabled we have a slow down of approx. 2x and so I would expect a maximum slow down of 2x (because the shortest path exploration is usually the fast part of the isochrone calculation). But it seems that the slow down factor is over 6x even for smaller time limits like 10min:
time curl 'localhost:8989/isochrone?point=52.550732,13.350878&profile=car&time_limit=600'
...
real 0m1,179s
user 0m0,000s
sys 0m0,018s
time curl 'localhost:8989/isochrone?point=52.550732,13.350878&profile=car_no_tc&time_limit=600'
...
real 0m7,464s
user 0m0,010s
sys 0m0,004s
Keep in mind that if turn costs are enabled the graph exploration is edge-based and so the shortest path tree is larger (contains edges that otherwise would be skipped as they point to already explored nodes). Maybe this could be an explanation?
so the shortest path tree is larger... Maybe this could be an explanation?
Not sure if this explains the sometimes big differences.
For version d621386 I found an example of >5x slow down using the france.pbf (the resulting shape is only slightly different). Bluish is with TC so slightly smaller:
Logs for visited and consumed nodes:
2020-07-21 14:26:10.490 [dw-22 - GET /isochrone?point=48.839413,2.351074&profile=car&time_limit=400] INFO c.g.resources.IsochroneResource - took: 5.5795646, visited nodes:486191, consumed nodes:62233, {time_limit=[400], profile=[car], point=[48.839413,2.351074]}
2020-07-21 14:26:19.208 [dw-19 - GET /isochrone?point=48.839413,2.351074&profile=car_no_tc&time_limit=400] INFO c.g.resources.IsochroneResource - took: 1.029165, visited nodes:170438, consumed nodes:35151, {time_limit=[400], profile=[car_no_tc], point=[48.839413,2.351074]}
Yeah but the shortest path trees could still be very different in size? In your example the number of visited nodes is very different (486191 for car vs 170438 for car_no_tc) so to me it seems like the real question is why in one case much less nodes are explored (could be due to better/worse LM heuristic?). Maybe MiniGraphUI could help here :)
The landmark generation probably depends on the size of the map (ile-de-france vs. france)? Which map did you exactly use @karussell? Can we use bayern-190101.osm.pbf or germany-190101.osm.pf maybe as these are the ones we use for benchmarks?
Hmm. Seems elusive. Works fine on my machine. Despite lots of visited nodes.
Thanks for investigating this @michaz. I think I found the problem: we use u_turn_costs: 80 in the config and without that I get the times for car with tc that you get (and the factor is roughly the expected 2x).
Still, let me try to give you the exact same conditions to reproduce the problem in this issue:
The described scenario requires many queue update/remove operations, which neither zero nor infinite turn-costs do. ShortestPathTree needs to be optimized for this. Is much faster for me now, needs some more testing.
Activity
karussell commentedon Jul 21, 2020
Strange. I cannot reproduce this on my local machine (4.5s vs. 2.8s) using this pbf. Closing for now.
easbar commentedon Jul 21, 2020
Keep in mind that if turn costs are enabled the graph exploration is edge-based and so the shortest path tree is larger (contains edges that otherwise would be skipped as they point to already explored nodes). Maybe this could be an explanation?
See this: https://discuss.graphhopper.com/t/missing-edges-in-spt-response/5586/4
karussell commentedon Jul 21, 2020
Not sure if this explains the sometimes big differences.
For version d621386 I found an example of >5x slow down using the france.pbf (the resulting shape is only slightly different). Bluish is with TC so slightly smaller:
Logs for visited and consumed nodes:
otbutz commentedon Jul 21, 2020
You could profile the execution using JFR if you're using Java 11 or higher.
JMC: https://adoptopenjdk.net/jmc.html
easbar commentedon Jul 21, 2020
Yeah but the shortest path trees could still be very different in size? In your example the number of visited nodes is very different (486191 for car vs 170438 for car_no_tc) so to me it seems like the real question is why in one case much less nodes are explored (could be due to better/worse LM heuristic?). Maybe MiniGraphUI could help here :)
michaz commentedon Jul 22, 2020
Hmm. Seems elusive. Works fine on my machine. Despite lots of visited nodes.
michaz commentedon Jul 22, 2020
Am I doing this right?
easbar commentedon Jul 22, 2020
The landmark generation probably depends on the size of the map (ile-de-france vs. france)? Which map did you exactly use @karussell? Can we use bayern-190101.osm.pbf or germany-190101.osm.pf maybe as these are the ones we use for benchmarks?
michaz commentedon Jul 22, 2020
Isochrones aren't using Landmarks...
easbar commentedon Jul 22, 2020
right... :)
karussell commentedon Jul 22, 2020
Thanks for investigating this @michaz. I think I found the problem: we use
u_turn_costs: 80in the config and without that I get the times forcarwith tc that you get (and the factor is roughly the expected 2x).Still, let me try to give you the exact same conditions to reproduce the problem in this issue:
-Xmx5g -Xms5g -Ddw.graphhopper.datareader.file=ile-de-france-200721.osm.pbf(http://download.geofabrik.de/europe/france/ile-de-france-200721.osm.pbf)Then I get:
For the current master 7fe8944 I get better times but the slow down is unchanged over 6x:
master without U turn costs:
[-]isochrone with turn costs enabled much slower[/-][+]SPT with turn costs enabled much slower[/+][-]SPT with turn costs enabled much slower[/-][+]SPT with finite, non-zero turn costs much slower[/+]michaz commentedon Jul 22, 2020
The described scenario requires many queue update/remove operations, which neither zero nor infinite turn-costs do. ShortestPathTree needs to be optimized for this. Is much faster for me now, needs some more testing.