Greatly improve Folder View performance and mem usage.

Authored by hein on Jan 30 2017, 10:00 AM.



Profiling suggests that Folder View spends most of its time
in delegate creation, which occurs en masse during various
operations, e.g. scrolling the view or navigating folder
hierarchy via popup dialogs or drill-down in list view mode.

This patch makes FolderItemDelegate substantially cheaper
by bringing down its child object count considerably via
a number of techniques:

  • Moving things that don't need to be in the delegate outside of it (e.g. a Timer that can be shared, a Connections that does work that can be done outside the delegate and a very costly ColorScope that can be moved up in the hierarchy.
  • Lazy-loading the expensive FrameSvgItem only in states which require it to be shown.
  • Managing action button life time procedurally as they are only needed during hover and even then only under a host of other conditions (instead of using Loaders, to save objects).

Previously, scrolling a 7x6 Folder View widget pointed at
my /usr/bin was nigh-unusable, now it's very nearly all
smooth. The desktop mode is a little slower (due to
expensive drop shadows below text labels) but also benefits.

This is a big refactor and needs more testing. In particular,
the spring-loading behavior needs thorough checking due to
code refactors.

Diff Detail

R119 Plasma Desktop
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
hein updated this revision to Diff 10696.Jan 30 2017, 10:00 AM
hein retitled this revision from to Greatly improve Folder View performance and mem usage..
hein updated this object.
hein edited the test plan for this revision. (Show Details)
hein added a reviewer: Plasma.
hein added a subscriber: plasma-devel.
Restricted Application added a project: Plasma. · View Herald TranscriptJan 30 2017, 10:00 AM
hein updated this revision to Diff 10699.Jan 30 2017, 10:15 AM

Rebase onto master.


I do get a bunch of warnings on startup, though:

file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderItemDelegate.qml:244:17: QML Text: Binding loop detected for property "width"

Spring-loading when dragging a file ontop of a folder no longer works (didn't see any obvious warnings on console)




I ran into quite some trouble (layouts, crashes, glitches) with async loaders in an item view, you said it didn't help anyways, so perhaps we can try without?


Could be simplified to

frameLoader.textShadow || label

typo frameLoader.x

That's why the drag pixmap doesn't work


QML nulls properties automatically if the item referenced is destroyed but I understand you want this explicitly




Careful with binding things to visible, it updates recursively and may cause unexpected re-evaluations or glitches when the applet popup opens/closes (like the folderview title bug)


Since we're all about speed here, "#fff" is ~6% faster than "white" :D

hein marked 7 inline comments as done.Jan 30 2017, 10:39 AM
hein added inline comments.

Will do.


Hmm well it's still kind of the right thing to do and probably helps a little bit. I'd say let's keep it until it actually causes problems? Note GridView has uniform delegate sizes (cell size is defined at the view level) so layout is much simpler in it than e.g. in ListView.


Will do.


Good catch! Actually I noticed it was broken, but forgot I still needed to fix it - I was finishing this half-asleep on the weekend ;).


Will do.


There's no visible changes in the parent chain and it's a leaf node, so should be fine though? Changed the color string.

hein updated this revision to Diff 10705.Jan 30 2017, 10:41 AM
hein marked 6 inline comments as done.

Address Kai's comments.

broulik accepted this revision.Feb 10 2017, 11:50 AM
broulik added a reviewer: broulik.
This revision is now accepted and ready to land.Feb 10 2017, 11:50 AM
This revision was automatically updated to reflect the committed changes.