Significant performance increase for specific use conditions

Authored by steinalexander on Jul 24 2018, 10:22 PM.

Description

Significant performance increase for specific use conditions

Summary:
Consider the following conditions:

  • a mail folder containg a lot (>20000) mail (e.g. lkml mails archived for 20 days)
  • threaded view

Depending where your current view is located (top or bottom of scroll list), expanding/collapsing all threads is either fast (~2s on my machine) or extremely slow (>15mins).
The reason is that in View::setAllThreadsExpanded() for all children setChildrenExpanded() is called which eventually causes a redraw for each item due to collapse/expand. This might also cause updating the model view due to increased/decreased total amount.
E.g. if the current view is at the bottom every collapse causes a redraw because the total lines in the message list is decrementing. If the current view is at the top this effect only kicks for the first items until the further changes are out of view.
I profiled those step once using perf. The result was about ~72% just qt_memfill32 due to Pixmap redrawal caused by MessageList::Core::View::setChildrenExpanded.

Fix this by calling scheduleDelayedItemsLayout() beforehand. This delays the redraw until tree traversal has finished (actually until event loop is entered again). Using this patch the collapse is finished in <<1s, indepentently where the current view position is. Actually the time is not really measurable.
While at it, also call scheduleDelayedItemsLayout() in View::setAllGroupsExpanded() which also might touch a lot of items.

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: lbeltrame, dvratil, kde-pim

Tags: KDE PIM

Differential Revision: https://phabricator.kde.org/D14242

Details

Committed
dvratilJul 24 2018, 10:23 PM
Reviewer
dvratil
Differential Revision
D14242: Significant performance increase for specific use conditions
Parents
R94:5689485799ae: GIT_SILENT: prepare rc
Branches
Unknown
Tags
Unknown