[lipstick] Process icon additions and removals in batches to improve performance #100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.