Significant performance increase for specific use conditions
ClosedPublic

Authored by steinalexander on Jul 20 2018, 8:25 AM.

Details

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.

Diff Detail

Repository
R94 PIM: Message Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
steinalexander created this revision.Jul 20 2018, 8:25 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptJul 20 2018, 8:25 AM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
steinalexander requested review of this revision.Jul 20 2018, 8:25 AM
dvratil accepted this revision.Jul 23 2018, 10:23 PM
dvratil added a subscriber: dvratil.

Looks good and indeed it massively speeds up loading of large threaded folders. Nice work!

This revision is now accepted and ready to land.Jul 23 2018, 10:23 PM

@steinalexander: Do you have commit access? Or do you need any of the developers to commit this for you?

@lbeltrame: I just recently created this account, so I probably won't have commit access.
So, please some developer, please commit

@steinalexander Can you tell me your email address so I can commit the change for you? Thanks

@dvratil: alexander.stein@mailbox.org

This revision was automatically updated to reflect the committed changes.