┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Brüns <[email protected]>2021-02-15 17:34:01 +0100
committerStefan Brüns <[email protected]>2021-02-15 17:34:01 +0100
commit7c0b5c08cc97eded7755ca5cef9c7e5ba5c15537 (patch)
tree2986c27d575a4520d50da480f1caec6d12306f36
parent68704c2a28eed5a066d76ed880dc1971b6afab04 (diff)
[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.
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp
index 0554bff60..d18387f51 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.cpp
+++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -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;