Greatly improve Folder View performance and mem usage.
ClosedPublic

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

Details

Summary

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

Repository
R119 Plasma Desktop
Branch
hein/fastFoldersNew
Lint
Lint Skipped
Unit
Unit Tests Skipped
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.

Neat!

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)

containments/desktop/package/contents/ui/FolderItemDelegate.qml
55

===

61

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?

79

Could be simplified to

frameLoader.textShadow || label
89

typo frameLoader.x

That's why the drag pixmap doesn't work

120

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

177

!==

292–293

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)

293

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.
containments/desktop/package/contents/ui/FolderItemDelegate.qml
55

Will do.

61

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.

79

Will do.

89

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 ;).

177

Will do.

292–293

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.