This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Avoid geometry collections copying #15201
Merged
Merged
Conversation
This file contains 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
pozdnyakov
force-pushed
the
mikhail_refactor_geometry_collection
branch
from
July 24, 2019 12:07
a890d09
to
cadc2d2
Compare
pozdnyakov
added
Core
The cross-platform C++ core, aka mbgl
performance
Speed, stability, CPU usage, memory usage, or power usage
labels
Jul 24, 2019
pozdnyakov
force-pushed
the
mikhail_refactor_geometry_collection
branch
from
July 24, 2019 12:46
cadc2d2
to
722967f
Compare
alexshalamov
approved these changes
Jul 24, 2019
pozdnyakov
force-pushed
the
mikhail_refactor_geometry_collection
branch
from
July 24, 2019 13:39
722967f
to
4392194
Compare
julianrex
approved these changes
Jul 24, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For reference, testing with a modified version of #15203. |
astojilj
reviewed
Jul 24, 2019
@@ -57,32 +57,31 @@ std::vector<GeometryCollection> classifyRings(const GeometryCollection& rings) { | |||
std::size_t len = rings.size(); | |||
|
|||
if (len <= 1) { | |||
polygons.push_back(rings); | |||
polygons.emplace_back(rings.clone()); | |||
return polygons; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I briefly checked in debugger - in majority of cases len == 1.
Following how classifyRings is used for (auto& polygon : classifyRings(geometry)) {
suggest to redesign clasifyRings so that it doesn't clone() but access the same const reference.
chloekraw
added
the
needs changelog
Indicates PR needs a changelog entry prior to merging.
label
Aug 1, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Core
The cross-platform C++ core, aka mbgl
needs changelog
Indicates PR needs a changelog entry prior to merging.
performance
Speed, stability, CPU usage, memory usage, or power usage
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.
mbgl::GeometryCollection
can potentially contain significant amount of data, however before this change we had several places whereGeometryCollection
instances were unnecessarily copied causing extra allocations, which affected the performance. In particular,queryRenderedFeatures
API performance was affected (see #15183).