Skip to content

Flex build time and memory optimization for large zones - #5233

Merged
leonardehrenfried merged 15 commits into
opentripplanner:dev-2.xfrom
ibi-group:flex-optimization
Jul 18, 2023
Merged

leonardehrenfried merged 15 commits into
opentripplanner:dev-2.xfrom
ibi-group:flex-optimization

Conversation

@leonardehrenfried

Copy link
Copy Markdown
Member

Summary

IBI has a few OTP installations which have very large flex zones (covering entire US counties and more) and
@miles-grant-ibigroup and @daniel-heppner-ibigroup have reported that in those cases build times are slow and memory consumption is very high.

This PR optimizes the build time by parallelizing it and uses an immutable Set to conserve memory - beforehand each Vertex would keep an instance of HashSet which uses potentially more space than necessary.

Unit tests

Added.

@leonardehrenfried leonardehrenfried added !Optimization The feature is to improve performance. IBI Developed by or important for IBI Group labels Jul 12, 2023
@leonardehrenfried
leonardehrenfried requested a review from a team as a code owner July 12, 2023 12:00
@codecov

codecov Bot commented Jul 12, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 94.82% and project coverage change: +0.02 🎉

Comparison is base (0b476db) 65.69% compared to head (33c2f9f) 65.71%.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5233      +/-   ##
=============================================
+ Coverage      65.69%   65.71%   +0.02%     
- Complexity     14723    14732       +9     
=============================================
  Files           1770     1770              
  Lines          68556    68579      +23     
  Branches        7288     7283       -5     
=============================================
+ Hits           45037    45069      +32     
+ Misses         21025    21021       -4     
+ Partials        2494     2489       -5     
Impacted Files Coverage Δ
...rg/opentripplanner/graph_builder/GraphBuilder.java 0.00% <0.00%> (ø)
...ripplanner/ext/flex/AreaStopsToVerticesMapper.java 95.00% <95.00%> (ø)
...planner/graph_builder/module/NearbyStopFinder.java 85.84% <100.00%> (+0.12%) ⬆️
...tripplanner/routing/linking/FlexLocationAdder.java 77.77% <100.00%> (+5.05%) ⬆️
...ntripplanner/street/model/vertex/StreetVertex.java 85.29% <100.00%> (+12.56%) ⬆️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@leonardehrenfried leonardehrenfried added the !Technical Debt Improve code quality, no functional changes. label Jul 12, 2023

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See my comments so far.

Comment thread src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java Outdated
Comment thread src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java Outdated
Comment thread src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java Outdated
Comment thread src/main/java/org/opentripplanner/street/model/vertex/StreetVertex.java Outdated

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm able to request flex trips with this PR , using Hopelink feeds, and the latest changes look good!

Comment thread src/ext/java/org/opentripplanner/ext/flex/FlexLocationsToStreetEdgesMapper.java Outdated
vpaturet
vpaturet previously approved these changes Jul 18, 2023
@leonardehrenfried
leonardehrenfried merged commit faa8989 into opentripplanner:dev-2.x Jul 18, 2023
t2gran pushed a commit that referenced this pull request Jul 18, 2023
@leonardehrenfried
leonardehrenfried deleted the flex-optimization branch July 21, 2023 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IBI Developed by or important for IBI Group !Optimization The feature is to improve performance. !Technical Debt Improve code quality, no functional changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants