Skip to content

Reuse the prepared area index for the point-in-area test#7723

Open
vpaturet wants to merge 1 commit into
opentripplanner:dev-2.xfrom
entur:option2-point-test-reuse
Open

Reuse the prepared area index for the point-in-area test#7723
vpaturet wants to merge 1 commit into
opentripplanner:dev-2.xfrom
entur:option2-point-test-reuse

Conversation

@vpaturet

@vpaturet vpaturet commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

When linking a vertex into a walkable area, VertexLinker.snapAndLink did the vertex-in-area check with a raw Polygon.contains(point), which rebuilds a sweep-line index over the polygon boundary on every call. Separately, addAreaVertex built a PreparedGeometry for the visibility-edge fan-out. So a single rental-in-area landing could build the area index up to three times.

This change builds one PreparedAreaGroup per area in snapAndLink and reuses it for:

addAreaVertex now takes the prepared group instead of rebuilding it.

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.09%. Comparing base (bd4897a) to head (63c1e47).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #7723      +/-   ##
=============================================
- Coverage      74.09%   74.09%   -0.01%     
- Complexity     21929    21930       +1     
=============================================
  Files           2430     2430              
  Lines          86054    86057       +3     
  Branches        8573     8573              
=============================================
+ Hits           63764    63765       +1     
- Misses         19251    19252       +1     
- Partials        3039     3040       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vpaturet vpaturet added !Optimization The feature is to improve performance. Entur Test This is currently being tested at Entur +Skip Changelog This is not a relevant change for a product owner since last release. labels Jun 17, 2026
@vpaturet vpaturet changed the title perf(street): reuse the prepared area index for the point-in-area test Reuse the prepared area index for the point-in-area test Jun 18, 2026
@vpaturet vpaturet force-pushed the option2-point-test-reuse branch from e066199 to 8256b44 Compare June 22, 2026 08:31
The vertex-in-area check in snapAndLink used a raw Polygon.contains(point),
which rebuilds a sweep-line index over the polygon boundary on every call,
while addAreaVertex separately built a PreparedGeometry for the visibility
fan-out. Build one PreparedAreaGroup per area and reuse it for the point
test, the forced split-point edge and the fan-out, so the index is built
once. Add PreparedAreaGroup.containsPoint and pass the prepared group into
addAreaVertex instead of rebuilding it there.

Behavior is unchanged (PreparedGeometry.contains matches Geometry.contains
for points and segments).
@vpaturet vpaturet force-pushed the option2-point-test-reuse branch from 8256b44 to 63c1e47 Compare June 22, 2026 08:41
@vpaturet vpaturet marked this pull request as ready for review June 22, 2026 08:44
@vpaturet vpaturet requested a review from a team as a code owner June 22, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Entur Test This is currently being tested at Entur !Optimization The feature is to improve performance. +Skip Changelog This is not a relevant change for a product owner since last release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants