[FileItemRolesUpdater] Reserve space in two temporary lists

Reserve sufficient space to avoid reallocation later. Overallocating
actually requires less memory than growing and copying it, and it
is freed immediately after anyway.
This commit is contained in:
Stefan Brüns 2021-02-15 17:34:01 +01:00
parent 68704c2a28
commit 7c0b5c08cc

View file

@ -954,6 +954,8 @@ void KFileItemModelRolesUpdater::updateChangedItems()
QList<int> visibleChangedIndexes;
QList<int> invisibleChangedIndexes;
visibleChangedIndexes.reserve(m_changedItems.size());
invisibleChangedIndexes.reserve(m_changedItems.size());
// Iterate over a const copy because items are deleted within the loop
const auto changedItems = m_changedItems;