Bug 421537 - New Window Rules kcm: scrolling through window rules list causes high cpu usage
Summary: New Window Rules kcm: scrolling through window rules list causes high cpu usage
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: general (show other bugs)
Version: 5.18.90
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-14 23:44 UTC by Patrick Silva
Modified: 2020-06-11 02:34 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.19.1


Attachments
screenshot (209.23 KB, image/png)
2020-05-14 23:44 UTC, Patrick Silva
Details
my rules (19.38 KB, text/plain)
2020-06-10 15:01 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-05-14 23:44:45 UTC
Created attachment 128468 [details]
screenshot

STEPS TO REPRODUCE
1. have dozens of window rules configured on your system
2. open system activity by pressing ctrl+esc
3. open system settings > window management > window rules
4. scroll the window rules list and observe the cpu usage

OBSERVED RESULT
high cpu usage, see the attached screenshot taken on X11 please.
On Wayland cpu usage is even worst, sometimes reaching 50% on my system.

EXPECTED RESULT
normal cpu usage

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.18.90
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0 rc2
Comment 1 carl 2020-05-15 07:48:34 UTC
I tried adding tons of empty rules and scroll in the list and I can see the high CPU usage but also lagging.
Comment 2 David Edmundson 2020-06-10 14:55:56 UTC
As I'm super lazy, could you export your rules and attach?
Comment 3 Patrick Silva 2020-06-10 15:01:08 UTC
Created attachment 129199 [details]
my rules

Of course.
Comment 4 Ismael Asensio 2020-06-10 20:16:10 UTC
Thanks for the rules attachment. I think I found the cause.
Submitting a fix.
Comment 5 Ismael Asensio 2020-06-10 21:29:11 UTC
Git commit e307038f84dc0fc0556b2ceb259da0c09b035ce1 by Ismael Asensio.
Committed on 10/06/2020 at 21:29.
Pushed by iasensio into branch 'Plasma/5.19'.

[kcm/kwinrules] Fix slow scrolling through rules list

Every `AbstractItemDelegate` was instantiating a `Kirigami.ActionToolBar`,
which is a very expensive component, rising CPU usage specially on long lists.

Use `Kirigami.SwipeListItem` instead, as is seems the proper component.

M  +23   -30   kcmkwin/kwinrules/package/contents/ui/RulesList.qml

https://invent.kde.org/plasma/kwin/commit/e307038f84dc0fc0556b2ceb259da0c09b035ce1