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:
parent
1f5583b433
commit
249d6cc311
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue