Revision ff3267c...

Go back to digest for 3rd February 2013

Optimization in KDE Base

Frank Reininghaus committed changes in [kde-baseapps] dolphin/src/kitemviews/kfileitemmodel.cpp:

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

File Changes

Modified 1 files
  • dolphin/src/kitemviews/kfileitemmodel.cpp
1 files changed in total