Skip to content

Commit abeed9f

Browse files
authored
Fix performance issue with groupDetectors2 (#39255)
1 parent 3f201fa commit abeed9f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Framework/DataHandling/src/GroupDetectors2.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,13 @@ size_t GroupDetectors2::formGroupsEvent(const DataObjects::EventWorkspace_const_
10101010
// Start fresh with no detector IDs
10111011
outEL.clearDetectorIDs();
10121012

1013+
// Reserve space for the event list
1014+
std::size_t totalEvents = 0;
1015+
for (auto i : it->second) {
1016+
totalEvents += inputWS->getSpectrum(i).getNumberEvents();
1017+
}
1018+
outEL.reserve(totalEvents);
1019+
10131020
// the Y values and errors from spectra being grouped are combined in the
10141021
// output spectrum
10151022
// Keep track of number of detectors required for masking

0 commit comments

Comments
 (0)