From dc19a6ab2775f68e82b6b55f863317aa2d90058e Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 18 Jan 2013 11:45:20 +0000 Subject: [PATCH 1/2] + use std::deque instead of std::vector and avoid expenssive re-alloc's --- include/mapnik/memory_datasource.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mapnik/memory_datasource.hpp b/include/mapnik/memory_datasource.hpp index 8ebb8f281..35a172f22 100644 --- a/include/mapnik/memory_datasource.hpp +++ b/include/mapnik/memory_datasource.hpp @@ -28,7 +28,7 @@ #include // stl -#include +#include namespace mapnik { @@ -48,7 +48,7 @@ public: size_t size() const; void clear(); private: - std::vector features_; + std::deque features_; mapnik::layer_descriptor desc_; datasource::datasource_t type_; bool bbox_check_; From 1ef9ec2b886e4d5494224912abcc4b9372c4d427 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 18 Jan 2013 12:27:29 +0000 Subject: [PATCH 2/2] + use std::deque for caching features. --- include/mapnik/memory_featureset.hpp | 6 +++--- plugins/input/csv/csv_datasource.hpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/mapnik/memory_featureset.hpp b/include/mapnik/memory_featureset.hpp index 7fd5d1e47..13ab3d4cf 100644 --- a/include/mapnik/memory_featureset.hpp +++ b/include/mapnik/memory_featureset.hpp @@ -45,7 +45,7 @@ public: bbox_check_(bbox_check) {} - memory_featureset(box2d const& bbox, std::vector const& features, bool bbox_check = true) + memory_featureset(box2d const& bbox, std::deque const& features, bool bbox_check = true) : bbox_(bbox), pos_(features.begin()), end_(features.end()), @@ -92,8 +92,8 @@ public: private: box2d bbox_; - std::vector::const_iterator pos_; - std::vector::const_iterator end_; + std::deque::const_iterator pos_; + std::deque::const_iterator end_; datasource::datasource_t type_; bool bbox_check_; }; diff --git a/plugins/input/csv/csv_datasource.hpp b/plugins/input/csv/csv_datasource.hpp index 96931878c..0d9e28b34 100644 --- a/plugins/input/csv/csv_datasource.hpp +++ b/plugins/input/csv/csv_datasource.hpp @@ -38,6 +38,7 @@ // stl #include +#include #include class csv_datasource : public mapnik::datasource @@ -66,7 +67,7 @@ private: std::string inline_string_; unsigned file_length_; mapnik::value_integer row_limit_; - std::vector features_; + std::deque features_; std::string escape_; std::string separator_; std::string quote_;