2.x branch optimization
@flippmoke is already working on this.
Since Jan 17, 2018.
Assessment
This issue has not been assessed yet.
Description
I noticed that layer_map<CoordinateType> decode_tile(std::string const& buffer) at https://github.com/mapbox/vector-tile/blob/95c240bd8c8373bc0c06966a62565c5d73fdef73/include/mapbox/vector_tile.hpp#L62-L84 does not leverage pre-allocation optimizations. We should likely do:
diff --git a/include/mapbox/vector_tile.hpp b/include/mapbox/vector_tile.hpp
index c61640b..0e8c672 100644
--- a/include/mapbox/vector_tile.hpp
+++ b/include/mapbox/vector_tile.hpp
@@ -66,12 +66,13 @@ layer_map<CoordinateType> decode_tile(std::string const& buffer)
while (auto layer = tile.next_layer())
{
mapbox::feature::feature_collection<CoordinateType> fc;
+ fc.reserve(layer.num_features());
while (auto feature = layer.next_feature())
{
auto f = extract_feature<CoordinateType>(feature);
if (!f.geometry.template is<mapbox::geometry::empty>())
{
- fc.push_back(f);
+ fc.push_back(std::move(f));
}
}
/cc @flippmoke to review and apply if this looks good.
- Dominant language
- C++
- Stars
- 52
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/vector-tile
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
mapbox/vector-tile#46 · 4 comments · 4 reactions ·
-
1.x
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mapbox/vector-tile#45 · 5 comments ·
-
2.x
Difficulty 5/5 Over a week Newbie friendliness 20/100
mapbox/vector-tile#43 ·
-
2.x
Difficulty 5/5 Over a week Newbie friendliness 30/100
mapbox/vector-tile#42 ·
-
Add Overzooming Open2.x
Difficulty 5/5 Over a week Newbie friendliness 25/100
mapbox/vector-tile#41 ·
All issues in mapbox/vector-tile
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·