diff options
| author | Frank Reininghaus <[email protected]> | 2013-01-27 13:07:46 +0100 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-01-27 13:07:46 +0100 |
| commit | d1b75d1d64d803d2b1099fb26f114342092249e3 (patch) | |
| tree | edba0127281556246c96e3f9fd4429c9efc9a155 /src/tests/kfileitemmodelbenchmark.cpp | |
| parent | 71be8f2bee8347460aebabd570b24f6393104423 (diff) | |
Performance improvements in KFileItemModel::removeItems()
The performance of this method is improved by:
a) Not removing items one by one, but doing it in a way that minimizes
the number of moves to prevent O(N^2) worst-case complexity.
b) Not sorting the removed items using the potentially extremely slow
KFileItemModel::lessThan. We can get the indexes of the removed items
very easily from the hash m_items, and sorting ints is a lot faster.
c) Preventing repeated rehashing of m_items when removing the deleted
URLs by replacing remove() by erase().
REVIEW: 108540
Diffstat (limited to 'src/tests/kfileitemmodelbenchmark.cpp')
0 files changed, 0 insertions, 0 deletions
