Micro performance optimisation in map matching (#6976)

This commit is contained in:
Siarhei Fedartsou 2024-06-29 19:59:08 +02:00 committed by GitHub
parent cacb1b23f9
commit 93c0e1dab3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -401,6 +401,7 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &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<Algorithm> &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;
}