Skip to content

Commit cedc4eb

Browse files
authored
[Common] Reserve memory upfront when creating the track propagation table (#16565)
1 parent 5ace237 commit cedc4eb

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

Common/Tools/TrackPropagationModule.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,24 @@ class TrackPropagationModule
234234
return; // suppress everything
235235
}
236236

237+
// Reserve every cursor filled in the loop below: reserve() switches the
238+
// cursor to the unsafe (no bounds check) append, so a cursor filled
239+
// without it pays the safe per-row append. The Par/ParExtension/DCA
240+
// tables are filled in the covariance branch as well.
241+
cursors.tracksParPropagated.reserve(tracks.size());
242+
cursors.tracksParExtensionPropagated.reserve(tracks.size());
243+
if (fillTracksDCA) {
244+
cursors.tracksDCA.reserve(tracks.size());
245+
}
237246
if (fillTracksCov) {
238247
cursors.tracksParCovPropagated.reserve(tracks.size());
239248
cursors.tracksParCovExtensionPropagated.reserve(tracks.size());
240249
if (fillTracksDCACov) {
241250
cursors.tracksDCACov.reserve(tracks.size());
242251
}
243-
} else {
244-
cursors.tracksParPropagated.reserve(tracks.size());
245-
cursors.tracksParExtensionPropagated.reserve(tracks.size());
246-
if (fillTracksDCA) {
247-
cursors.tracksDCA.reserve(tracks.size());
248-
}
252+
}
253+
if (cGroup.useTrackTuner.value && cGroup.fillTrackTunerTable.value) {
254+
cursors.tunertable.reserve(tracks.size());
249255
}
250256

251257
for (const auto& track : tracks) {

0 commit comments

Comments
 (0)