]> cloud.milkyroute.net Git - dolphin.git/commit
Performance improvements in KFileItemModel::removeItems()
authorFrank Reininghaus <frank78ac@googlemail.com>
Sun, 27 Jan 2013 12:07:46 +0000 (13:07 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sun, 27 Jan 2013 12:07:46 +0000 (13:07 +0100)
commitd1b75d1d64d803d2b1099fb26f114342092249e3
treeedba0127281556246c96e3f9fd4429c9efc9a155
parent71be8f2bee8347460aebabd570b24f6393104423
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
src/kitemviews/kfileitemmodel.cpp