wkb_reader : pre-allocate number of polygons in multi_polygon and number of geometries in geometry_collection via vector.reserce(...)

This commit is contained in:
artemp 2017-07-03 15:18:23 +02:00
parent 1f5583b433
commit 249d6cc311

View file

@ -354,6 +354,7 @@ private:
{ {
int num_polys = read_integer(); int num_polys = read_integer();
mapnik::geometry::multi_polygon<double> multi_poly; mapnik::geometry::multi_polygon<double> multi_poly;
multi_poly.reserve(num_polys);
for (int i = 0; i < num_polys; ++i) for (int i = 0; i < num_polys; ++i)
{ {
pos_ += 5; pos_ += 5;
@ -366,6 +367,7 @@ private:
{ {
int num_geometries = read_integer(); int num_geometries = read_integer();
mapnik::geometry::geometry_collection<double> collection; mapnik::geometry::geometry_collection<double> collection;
collection.reserve(num_geometries);
for (int i = 0; i < num_geometries; ++i) for (int i = 0; i < num_geometries; ++i)
{ {
pos_ += 1; // skip byte order pos_ += 1; // skip byte order