Skip to content

Commit

Permalink
refactor: Reserve memory in advance and move object instead of copying (
Browse files Browse the repository at this point in the history
acts-project#3091)

as the title says. 

Most likely the second is not an issue since it's just a proxy ... but still it does not hurt
  • Loading branch information
CarloVarni authored and Ragansu committed Apr 19, 2024
1 parent 887afd2 commit 70aeaa3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,7 @@ class CombinatorialKalmanFilter {
}

std::vector<typename TrackContainer::TrackProxy> tracks;
tracks.reserve(combKalmanResult.lastMeasurementIndices.size());

for (auto tip : combKalmanResult.lastMeasurementIndices) {
auto track = trackContainer.makeTrack();
Expand All @@ -1208,7 +1209,7 @@ class CombinatorialKalmanFilter {

calculateTrackQuantities(track);

tracks.push_back(track);
tracks.push_back(std::move(track));
}

return tracks;
Expand Down

0 comments on commit 70aeaa3

Please sign in to comment.