Skip to content

Commit

Permalink
Micro performance optimisation in map matching (#6976)
Browse files Browse the repository at this point in the history
  • Loading branch information
SiarheiFedartsou authored Jun 29, 2024
1 parent cacb1b2 commit 93c0e1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/engine/routing_algorithms/map_matching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 93c0e1d

Please sign in to comment.