Skip to content
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

perf(fastisochrones): apply modifications from regular isochrones #1658

Merged
merged 14 commits into from
Feb 27, 2024

Conversation

aoles
Copy link
Member

@aoles aoles commented Jan 30, 2024

Pull Request Checklist

  • 1. I have rebased the latest version of the main branch into my feature branch and all conflicts
    have been resolved.
  • 2. I have added information about the change/addition to functionality to the CHANGELOG.md file under the
    [Unreleased] heading.
  • 3. I have documented my code using JDocs tags.
  • 4. I have removed unnecessary commented out code, imports and System.out.println statements.
  • 5. I have written JUnit tests for any new methods/classes and ensured that they pass.
  • 6. I have created API tests for any new functionality exposed to the API.
  • 7. If changes/additions are made to the ors-config.json file, I have added these to the ors config documentation
    along with a short description of what it is for, and documented this in the Pull Request (below).
  • 8. I have built graphs with my code of the Heidelberg.osm.gz file and run the api-tests with all test passing
  • 9. I have referenced the Issue Number in the Pull Request (if the changes were from an issue).
  • 10. For new features or changes involving building of graphs, I have tested on a larger dataset
    (at least Germany), and the graphs build without problems (i.e. no out-of-memory errors).
  • 11. For new features or changes involving the graphbuilding process (i.e. changing encoders, updating the
    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.
  • 12. I have written in the Pull Request information about the changes made including their intended usage
    and why the change was needed.
  • 13. For changes touching the API documentation, I have tested that the API playground renders correctly.

Information about the changes

Build- and query-time optimizations based on the previous work on regular isochrones in #1607:

  • Replace concave hull algorithm with JTS implementation
  • Do not perform neighbor search when adding new elements to the point cloud, both for preparation and for query
  • Reduce splitting length according to splitting factor
  • Avoid unnecessary edge splitting in fully reachable and active cells

Examples and reasons for differences between live ORS routes, and those generated from this pull request

Changes to isochrone geometries in API tests (blue is reference, red is new)

testIntersections

image

testPolygon

image

testSmoothing

image
image

@aoles aoles force-pushed the perf/fast_isochrones branch from 8a81b37 to 56ce464 Compare February 5, 2024 11:25
@aoles aoles self-assigned this Feb 7, 2024
@aoles aoles force-pushed the perf/fast_isochrones branch 2 times, most recently from 92357b4 to 2e2564d Compare February 9, 2024 00:38
@aoles
Copy link
Member Author

aoles commented Feb 11, 2024

Comprehensive assessment of the changes introduced by this PR:

To summarize, changes introduced to the preparation part (constructing cell geometries) doesn't seem to have much impact on the overall performance, neither the actual build times, nor the query times. Some small differences in the resulting geometries are observed after switching the algorithm from ConcaveHullOpenSphere to JTS ConcaveHull. The actual performance gain comes from adapting the query time optimizations:

  • removing neighbor search
  • and reducing the splitting length based on the smoothing factor

each of which individually improves the performance by around 18% and 17%, respectively. The combined performance gain introduced by this PR is around 33%.

Last but not least, there now seem to be a better overlap with the geometries produced by regular isochrones.

@aoles aoles changed the title perf(fastisochrones): apply performance improvements from regular isochrones perf(fastisochrones): apply modificaions from regular isochrones Feb 22, 2024
aoles and others added 12 commits February 22, 2024 15:15
Replace `ConcaveHullOpenSphere` with jts `ConcaveHull` algorithm.
Remove neighbour search when adding points.
It is not necessary to split long edges before storing cell geometries. This is so because at query time all fully reachable cell geometries are being merged, and the resulting polygon's edges split afterwards. This optimization reduces the cell storage by around 30%.
   
It is not necessary to split long edges of active cells' concave hulls because the resulting polygons are being merged with the fully reachable cells, after which the splitting has to be performed anyways.
Avoids speed reduction on ways tagged with `access=destination`.
@aoles aoles force-pushed the perf/fast_isochrones branch from 01b2283 to c4e48bf Compare February 22, 2024 14:15
@aoles aoles marked this pull request as ready for review February 22, 2024 14:21
@aoles aoles changed the title perf(fastisochrones): apply modificaions from regular isochrones perf(fastisochrones): apply modifications from regular isochrones Feb 26, 2024
@jhaeu jhaeu requested a review from sfendrich February 26, 2024 11:56
Copy link
Contributor

@sfendrich sfendrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor questions.

Copy link
Contributor

@sfendrich sfendrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@sfendrich sfendrich merged commit 9abd435 into main Feb 27, 2024
10 checks passed
@sfendrich sfendrich deleted the perf/fast_isochrones branch February 27, 2024 10:36
@MichaelsJP MichaelsJP added this to the V8 Release milestone Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Awaiting release
Development

Successfully merging this pull request may close these issues.

4 participants