Skip to content

Commit 93c0e1d

Browse files
Micro performance optimisation in map matching (#6976)
1 parent cacb1b2 commit 93c0e1d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- NodeJS:
2525
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
2626
- Misc:
27+
- CHANGED: Micro performance optimisation in map matching. [#6976](https://github.com/Project-OSRM/osrm-backend/pull/6976)
2728
- CHANGED: Re-use priority queue in StaticRTree. [#6952](https://github.com/Project-OSRM/osrm-backend/pull/6952)
2829
- CHANGED: Optimise encodePolyline function. [#6940](https://github.com/Project-OSRM/osrm-backend/pull/6940)
2930
- CHANGED: Avoid reallocations in base64 encoding. [#6951](https://github.com/Project-OSRM/osrm-backend/pull/6951)

src/engine/routing_algorithms/map_matching.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
401401
auto trace_distance = 0.0;
402402
matching.nodes.reserve(reconstructed_indices.size());
403403
matching.indices.reserve(reconstructed_indices.size());
404+
matching.alternatives_count.reserve(reconstructed_indices.size());
404405
for (const auto &idx : reconstructed_indices)
405406
{
406407
const auto timestamp_index = idx.first;
@@ -428,7 +429,7 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
428429

429430
matching.confidence = confidence(trace_distance, matching_distance);
430431

431-
sub_matchings.push_back(matching);
432+
sub_matchings.emplace_back(std::move(matching));
432433
sub_matching_begin = sub_matching_end;
433434
}
434435

0 commit comments

Comments
 (0)