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

Improve performance of speculative rental vehicle use in reverse search #6260

Merged

Conversation

tkalvas
Copy link
Contributor

@tkalvas tkalvas commented Nov 18, 2024

Summary

Do not speculate use of rental networks which are not allowed by the request. They just cause extra states,
which in the end will not reach targets anyway.

Issue

The speculative fanout of extra rental network states can be massive in pathological cases, and serious
in accidental difficult cases.

Unit tests

The existing test StreetEdgeGeofencingTest did not find as many new states as it used to, and this
shows exactly what the fix is about. The expectation of the result was changed accordingly.

I can get better code coverage if this is not rejected outright.

Documentation

No documentation change, no high-level visible behavior state except execution speed.

Changelog

Could consider skip changelog.

Bumping the serialization version id

No.

@tkalvas tkalvas requested a review from a team as a code owner November 18, 2024 14:10
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.71%. Comparing base (481c3b8) to head (5b5c68a).
Report is 416 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
.../opentripplanner/street/model/edge/StreetEdge.java 90.32% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6260      +/-   ##
=============================================
- Coverage      69.73%   69.71%   -0.02%     
- Complexity     17681    17701      +20     
=============================================
  Files           2007     2008       +1     
  Lines          75776    75844      +68     
  Branches        7755     7769      +14     
=============================================
+ Hits           52845    52878      +33     
- Misses         20218    20255      +37     
+ Partials        2713     2711       -2     

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


🚨 Try these New Features:

@optionsome optionsome self-requested a review November 19, 2024 10:52
@tkalvas tkalvas changed the title Reduce CPU cost of speculative rental vehicle use in reverse search Improve performance of speculative rental vehicle use in reverse search Nov 19, 2024
@optionsome optionsome added Improvement Optimization The feature is to improve performance. labels Nov 19, 2024
@optionsome optionsome added this to the 2.7 (next release) milestone Nov 19, 2024
@leonardehrenfried
Copy link
Member

Can you fix the formatting?

@tkalvas
Copy link
Contributor Author

tkalvas commented Nov 20, 2024

Yeah.. didn't even check, but of course the new parameter made the code too wide. Fixed now.

final State speculativeRenting = states[1];
final State speculativeRenting = states[2];
Copy link
Member

Choose a reason for hiding this comment

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

Why did the order of states change btw?

Copy link
Contributor Author

@tkalvas tkalvas Nov 21, 2024

Choose a reason for hiding this comment

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

We only know if the unknown network case will be generated after generating the known cases. With recursive streams it was stuffed in the middle, but with an array it's easier (and more performant) to put it in the end. It shouldn't really matter what the order is, but in debugging it can be helpful that it is stable, so using State[] and not Set<State> is understandable.

@optionsome optionsome merged commit a447a26 into opentripplanner:dev-2.x Nov 22, 2024
5 checks passed
@optionsome optionsome deleted the speculative-rental-fanout branch November 22, 2024 09:43
t2gran pushed a commit that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Optimization The feature is to improve performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants