File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -260,6 +260,7 @@ TracksManager TracksManager::ConstructSubTracksManager(
260260 const std::vector<TrackId>& tracks,
261261 const std::vector<ShotId>& shots) const {
262262 std::unordered_set<TrackId> shotsTmp;
263+ shotsTmp.reserve (shots.size ());
263264 for (const auto & id : shots) {
264265 shotsTmp.insert (id);
265266 }
@@ -308,6 +309,7 @@ TracksManager::GetAllPairsConnectivity(
308309
309310 std::vector<TrackId> tracks_to_use;
310311 if (tracks.empty ()) {
312+ tracks_to_use.reserve (shots_per_track_.size ());
311313 for (const auto & [track_id, observations] : shots_per_track_) {
312314 tracks_to_use.push_back (track_id);
313315 }
@@ -317,10 +319,12 @@ TracksManager::GetAllPairsConnectivity(
317319
318320 std::unordered_set<ShotId> shots_to_use;
319321 if (shots.empty ()) {
322+ shots_to_use.reserve (tracks_per_shot_.size ());
320323 for (const auto & [shot_id, observations] : tracks_per_shot_) {
321324 shots_to_use.insert (shot_id);
322325 }
323326 } else {
327+ shots_to_use.reserve (shots.size ());
324328 for (const auto & shot : shots) {
325329 shots_to_use.insert (shot);
326330 }
You can’t perform that action at this time.
0 commit comments