nemomobile/lipstick — pull request #100 by Vesuri (2013-10-09 14:21:55+00:00)
Title: [lipstick] Process icon additions and removals in batches to improve performance

Currently adding a .desktop file in /usr/share/applications causes that file to be processed and added to the model immediately. Likewise, removing a file causes it to be removed from the model immediately. Unfortunately the QML GridView, for example, isn't very efficient at handling additions and especially not removals. Removing multiple items at the same time one by one takes a lot of time: removing 400 .desktop files at once will cause the UI to freeze for over 30 seconds on a moderately quick system. To work around this, this patch does additions and removals in batches if no files have changed during the last half a second. When doing so, it also resets the model completely if more than one item has changed, instead of changing the model one by one (causing the GridView, for example, to relayout all the items).

For 400 items this shaves off about a second or two from the addition time and about 27 seconds from the removal time.