perf(isochrones): Increase edge splitting threshold #1508
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
have been resolved.
[Unreleased] heading.
along with a short description of what it is for, and documented this in the Pull Request (below).
(at least Germany), and the graphs build without problems (i.e. no out-of-memory errors).
importer etc.), I have generated longer distance routes for the affected profiles with different options
(avoid features, max weight etc.) and compared these with the routes of the same parameters and start/end
points generated from the current live ORS.
If there are differences then the reasoning for these MUST be documented in the pull request.
and why the change was needed.
Fixes # .
Information about the changes
Key functionality added: 2x speedup of isochrone generation time.
Reason for change: Setting the threshold for edge splitting to a low value slows down isochrone generation because of the increased amount of points which need to be processed when calculating the geometry. Initial benchmarks have revealed that increasing the current threshold of 20m to 200m yields acceptable results while drastically improving performance.
The edge splitting threshold has been verified by running some benchmark and assessing the results both in terms of performance and visual aspects of the generated geometries. All files are available on GitLab, while the resulting report can be viewed at RPubs.
The benchmark consisted of performing 10 isochrone queries for the car profile at 10 random locations within the DACH region. Each query requested a 60min isochrone split into 20min ranges. First, the cumulative distribution of edge distances have been gathered. This revealed that for the original threshold of 20m almost 70% of edges get split. Increasing this value 10-fold reduces the amount of splitted edges to 5% as illustrated by the following figure.
Then three scenarios have been evaluated: the original splitting of edges into 20m segments, splitting into 200m segments, and not doing any splitting at all. While the original 20m splitting introduces a significant 2-3x performance penalty, splitting based on 200m threshold is only 20% slower compared to no splitting.
Not splitting long edges may occasionally introduce weird geometrical artifacts. The following figure compares an isochrone without edge splitting (red) to one calculated with 20m splitting.
These issues are mostly resolved with the 200m threshold while keeping the computation time low.
Examples and reasons for differences between live ORS routes, and those generated from this pull request
Blue is the original isochrone geometry while the red one was generated with this PR.