Pre-allocate up-front whenever possible
This commit is contained in:
@@ -193,6 +193,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
((parsed_way.forward_speed != parsed_way.backward_speed) ||
|
||||
(parsed_way.forward_travel_mode != parsed_way.backward_travel_mode));
|
||||
|
||||
external_memory.used_node_id_list.reserve(external_memory.used_node_id_list.size() +
|
||||
input_way.nodes().size());
|
||||
|
||||
std::transform(input_way.nodes().begin(),
|
||||
input_way.nodes().end(),
|
||||
std::back_inserter(external_memory.used_node_id_list),
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
@@ -105,9 +105,11 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, http::r
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(result.is<std::string>());
|
||||
current_reply.content.resize(current_reply.content.size() +
|
||||
result.get<std::string>().size());
|
||||
std::copy(result.get<std::string>().cbegin(),
|
||||
result.get<std::string>().cend(),
|
||||
std::back_inserter(current_reply.content));
|
||||
current_reply.content.end());
|
||||
|
||||
current_reply.headers.emplace_back("Content-Type", "application/x-protobuf");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user