Skip to content

Minor performance improvements#3767

Merged
hannesj merged 3 commits into
opentripplanner:dev-2.xfrom
entur:otp2_perf_improvements
Dec 7, 2021
Merged

Minor performance improvements#3767
hannesj merged 3 commits into
opentripplanner:dev-2.xfrom
entur:otp2_perf_improvements

Conversation

@hannesj

@hannesj hannesj commented Dec 6, 2021

Copy link
Copy Markdown
Contributor

Summary

When profiling the walkable area builder, I also took a look at the routing performance, and found these two low hanging fruits for performance increases.

There are two potential additional easy wins, which should be looked at

  • Moving turn restrictions from graph to edges
  • Not using a HashSet in RaptorRoutingRequestTransitData#routeIterator

getBannedRoutes is currently responsible of the majority of time in setRoutingContext
This reduces street routing time by approximately 5%
@hannesj hannesj requested a review from a team as a code owner December 6, 2021 13:48
ALL(4 | 2 | 1);

private static final Map<Integer, StreetTraversalPermission> lookup = new HashMap<Integer, StreetTraversalPermission>();
private static final StreetTraversalPermission[] lookup = new StreetTraversalPermission[8];

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.

Can you replace the 8 with a call to EnumSet.allOf(StreetTraversalPermission.class).size() in the static initializer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@leonardehrenfried

Copy link
Copy Markdown
Member

This looks good. Since I've contributed a couple of tests that check the street routing in a lot of detail I'm satisfied that this change doesn't change the logic.

@hannesj hannesj force-pushed the otp2_perf_improvements branch from ef05fa1 to 05d2819 Compare December 6, 2021 20:41
@t2gran t2gran added this to the 2.1 milestone Dec 7, 2021
@t2gran t2gran added the !Improvement A functional improvement or micro feature label Dec 7, 2021
@t2gran t2gran requested a review from optionsome December 7, 2021 10:38
@hannesj hannesj merged commit 370a75a into opentripplanner:dev-2.x Dec 7, 2021
t2gran pushed a commit that referenced this pull request Dec 7, 2021
@hannesj hannesj deleted the otp2_perf_improvements branch March 15, 2022 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Improvement A functional improvement or micro feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants