diff --git a/CHANGELOG.md b/CHANGELOG.md index 1495a57d2..22bebae0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - NodeJS: - CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452) - Misc: + - CHANGED: Micro performance optimisation in map matching. [#6976](https://github.com/Project-OSRM/osrm-backend/pull/6976) - CHANGED: Re-use priority queue in StaticRTree. [#6952](https://github.com/Project-OSRM/osrm-backend/pull/6952) - CHANGED: Optimise encodePolyline function. [#6940](https://github.com/Project-OSRM/osrm-backend/pull/6940) - CHANGED: Avoid reallocations in base64 encoding. [#6951](https://github.com/Project-OSRM/osrm-backend/pull/6951) diff --git a/src/engine/routing_algorithms/map_matching.cpp b/src/engine/routing_algorithms/map_matching.cpp index 9f8a1d2a5..41f1f3405 100644 --- a/src/engine/routing_algorithms/map_matching.cpp +++ b/src/engine/routing_algorithms/map_matching.cpp @@ -401,6 +401,7 @@ SubMatchingList mapMatching(SearchEngineData &engine_working_data, auto trace_distance = 0.0; matching.nodes.reserve(reconstructed_indices.size()); matching.indices.reserve(reconstructed_indices.size()); + matching.alternatives_count.reserve(reconstructed_indices.size()); for (const auto &idx : reconstructed_indices) { const auto timestamp_index = idx.first; @@ -428,7 +429,7 @@ SubMatchingList mapMatching(SearchEngineData &engine_working_data, matching.confidence = confidence(trace_distance, matching_distance); - sub_matchings.push_back(matching); + sub_matchings.emplace_back(std::move(matching)); sub_matching_begin = sub_matching_end; }