Fix O(N^2) complexity issue in KItemListView::slotItemsRemoved

Review Request #111398 - Created July 4, 2013 and submitted

Information
Frank Reininghaus
kde-baseapps
master
Reviewers
dolphin
In a directory which is shown in Dolphin, try the following (where N is a large number > 100000):

touch {1..N}.png
touch {1..N}.jpg

(wait until all files are shown in the view)

rm *.jpg

This will freeze Dolphin for quite some time (if not, try to increase the number of files). This is because KItemListView::slotItemsRemoved() has a loop over all removed item ranges (100000 in this case), and in each loop, it has another loop that iterates through all items and tries to find visible ones. This is bad because there is always only a small number of visible items, so we better just iterate over those (similar to the approach in KItemListView::slotItemsInserted).
Dolphin takes a lot less time to remove many item ranges.

Issues

  • 1
  • 0
  • 0
  • 1
Description From Last Updated
This if doesn't seem to do anything, only the elseif.. Perhaps just remove it and end up with: if (i ... Mark Gaiser Mark Gaiser
Elvis Stansvik
Mark Gaiser
Emmanuel Pescosta
Commit Hook
Frank Reininghaus
Review request changed

Status: Closed (submitted)

Loading...