┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-02-06 18:58:54 +0100
committerFrank Reininghaus <[email protected]>2013-02-06 18:58:54 +0100
commitac6d3d8250fdceeccdc692af96d74581512f23b2 (patch)
tree9c3f7c17f38973644785da3d885ab54897bdd3c8 /src
parent687d5145a25b99255065035ec63f3a29c711367d (diff)
KFileItemModel::insertItems(): reserve sufficient space for m_items
This prevents expensive and unnecessary repeated rehashing when many items are inserted into the model.
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index e315eee50..a763b3fff 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -987,6 +987,7 @@ void KFileItemModel::insertItems(const KFileItemList& items)
// The indexes of all m_items must be adjusted, not only the index
// of the new items
const int itemDataCount = m_itemData.count();
+ m_items.reserve(itemDataCount);
for (int i = 0; i < itemDataCount; ++i) {
m_items.insert(m_itemData.at(i)->item.url(), i);
}