Reduce allocations when building linestrings#7516
Open
leonardehrenfried wants to merge 5 commits intodev-2.xfrom
Open
Reduce allocations when building linestrings#7516leonardehrenfried wants to merge 5 commits intodev-2.xfrom
leonardehrenfried wants to merge 5 commits intodev-2.xfrom
Conversation
081a6ba to
f7fcd6e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7516 +/- ##
=============================================
- Coverage 71.31% 71.29% -0.03%
- Complexity 21137 21211 +74
=============================================
Files 2357 2365 +8
Lines 87556 87753 +197
Branches 8665 8681 +16
=============================================
+ Hits 62438 62560 +122
- Misses 22108 22179 +71
- Partials 3010 3014 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
habrahamsson-skanetrafiken
requested changes
Apr 14, 2026
| * segment of the pattern visits. | ||
| */ | ||
| public static List<Coordinate> extractTransitLegCoordinates( | ||
| public static LineString extractTransitLegCoordinates( |
Contributor
There was a problem hiding this comment.
Maybe we should rename this to extractSubGeometry or something?
vpaturet
previously approved these changes
Apr 14, 2026
Contributor
vpaturet
left a comment
There was a problem hiding this comment.
This looks good, nothing to mention besides the renaming suggested by Henrik.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces allocations by skipping conversions from
LinestringtoList<Coordinate>.A few places in the code wastefully construct fully materialized lists of coordinates when the more compact
LinestringorCoordinateSequenceis available. This code changes that to reduce the number of allocations thereby increasing efficiency.Unit tests
Two unit tests had to be changed but this code makes the output actually more correct: the previous version included duplicate coordinates, which this PR removes.
Bumping the serialization version id
Transfer is changed, but only the return type of a method, no serialized fields.