Skip to content

Commit

Permalink
reserve memory before append in a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Apr 29, 2023
1 parent 2ffed46 commit c7f7ec1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/track/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ Track::ImportStatus Track::importCueInfos(
// Clear all existing cue points, that are supposed
// to be replaced with the imported cue points soon.
QList<CuePointer> cuePoints;
cuePoints.reserve(m_cuePoints.size());
for (const CuePointer& pCue : qAsConst(m_cuePoints)) {
if (!m_pCueInfoImporterPending->hasCueOfType(pCue->getType())) {
cuePoints.append(pCue);
Expand Down Expand Up @@ -1398,6 +1399,7 @@ bool Track::exportSeratoMetadata() {
const mixxx::audio::SampleRate sampleRate =
streamInfo->getSignalInfo().getSampleRate();
QList<mixxx::CueInfo> cueInfos;
cueInfos.reserve(m_cuePoints.size());
for (const CuePointer& pCue : qAsConst(m_cuePoints)) {
cueInfos.append(pCue->getCueInfo(sampleRate));
}
Expand Down

0 comments on commit c7f7ec1

Please sign in to comment.