Skip to content

Optimize RAPTOR trip search by pre-calculating arrival/departure time arrays - #3919

Merged
hannesj merged 3 commits into
opentripplanner:dev-2.xfrom
entur:otp2_optimize_trip_search
Feb 22, 2022
Merged

Optimize RAPTOR trip search by pre-calculating arrival/departure time arrays#3919
hannesj merged 3 commits into
opentripplanner:dev-2.xfrom
entur:otp2_optimize_trip_search

Conversation

@hannesj

@hannesj hannesj commented Feb 19, 2022

Copy link
Copy Markdown
Contributor

Summary

Much of the time in the RAPTOR search is spent in fetching time tables for individual trips. This PR improves the performance by pre-calculating the times in an array, which can be scanned over.

Average speed test run times (n=10):
Upstream: 9.31s
2d arrays: 9.24s
1d arrays: 7.98s

image

Unit tests

None added

Code style

Documentation

None needed

Changelog

The changelog file
is generated from the pull-request title, make sure the title describe the feature or issue fixed.
To exclude the PR from the changelog add [changelog skip] in the title.

@hannesj hannesj added the !Optimization The feature is to improve performance. label Feb 19, 2022
@hannesj hannesj added this to the 2.1 milestone Feb 19, 2022
@hannesj
hannesj requested a review from t2gran February 19, 2022 17:46
*/
int numberOfTripSchedules();

public class Times {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Name: BoardAndAlightTimes

@hannesj
hannesj force-pushed the otp2_optimize_trip_search branch 3 times, most recently from 37ace0b to 1ed48fa Compare February 21, 2022 16:14
@hannesj
hannesj marked this pull request as ready for review February 21, 2022 16:28
@hannesj
hannesj requested a review from a team as a code owner February 21, 2022 16:28
@hannesj
hannesj force-pushed the otp2_optimize_trip_search branch from 1ed48fa to ce7082d Compare February 21, 2022 23:44
@hannesj
hannesj force-pushed the otp2_optimize_trip_search branch from ce7082d to c1e4151 Compare February 21, 2022 23:45
@leonardehrenfried

Copy link
Copy Markdown
Member

This looks really promising - thanks looking into it!

@hannesj
hannesj force-pushed the otp2_optimize_trip_search branch from c6cc4ca to 4c16a22 Compare February 22, 2022 08:40

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I used this PR on one of my densest data sets and it improved the performance by 5-10%.

@hannesj
hannesj merged commit 9d23a65 into opentripplanner:dev-2.x Feb 22, 2022
@hannesj
hannesj deleted the otp2_optimize_trip_search branch February 22, 2022 15:27
t2gran pushed a commit that referenced this pull request Feb 22, 2022
@hannesj hannesj mentioned this pull request Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Optimization The feature is to improve performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants