Bug 493376 - Selecting multiple .desktop files on the desktop causes extreme lag
Summary: Selecting multiple .desktop files on the desktop causes extreme lag
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Folder (show other bugs)
Version: 6.1.5
Platform: Manjaro Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-19 17:52 UTC by alt
Modified: 2024-11-15 17:38 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.0
Sentry Crash Report:


Attachments
Video of the desktop lagging (2.90 MB, video/webm)
2024-09-21 00:27 UTC, alt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description alt 2024-09-19 17:52:21 UTC
SUMMARY
Quickly selecting/deselecting multiple .desktop files on the desktop using the selection rectangle causes lag and throttling, especially if at least 10 (the minimum number may vary) are being selected in a row or column.

STEPS TO REPRODUCE
1. Add at least 10 different .desktop files (symlinks) from the application launcher by right-clicking on an each app and selecting "Add to Desktop".
2. Align all the files in one or multiple rows/columns on the desktop.
3. Hold the left mouse button and quickly move the cursor until they are all selected, then quickly move it backwards while still holding the button to deselect them one by one.
4. Repeat the previous point multiple times to cause lag.

OBSERVED RESULT
You should notice visible lag.
I also get this message from the system log: "systemd[1]: Looping too fast. Throttling execution a little."

EXPECTED RESULT
There should be no lag at all.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.9.12-3-MANJARO (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION

I'm using a hybrid graphics laptop (Intel + Nvidia).

Operating System: Manjaro Linux 
Processors: 12 × 13th Gen Intel® Core™ i5-13420H
Memory: 15,3 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Comment 1 alt 2024-09-19 17:56:25 UTC
This issue may be related to https://bugs.kde.org/show_bug.cgi?id=489894
Comment 2 alt 2024-09-19 18:07:53 UTC
(In reply to alt from comment #1)
> This issue may be related to https://bugs.kde.org/show_bug.cgi?id=489894

I was able to reproduce this bug too
Comment 3 Nate Graham 2024-09-19 18:54:31 UTC
Do any of the apps have large images set as their icons? If so, this is probably another manifestation of Bug 489894.
Comment 4 alt 2024-09-20 00:11:40 UTC
No, they are just ordinary icons, less than 100 kB
Comment 5 Nate Graham 2024-09-20 16:48:16 UTC
Hmm, OK. I can't reproduce it, unfortunately.
Comment 6 alt 2024-09-20 23:57:27 UTC
(In reply to Nate Graham from comment #5)
> Hmm, OK. I can't reproduce it, unfortunately.

I was able to reproduce it on a live USB of Manjaro, but I had to switch to a Wayland session because this issue doesn't happen with X11. I'll add a video as an attachment.
Comment 7 alt 2024-09-21 00:27:45 UTC
Created attachment 173927 [details]
Video of the desktop lagging
Comment 8 Nate Graham 2024-11-05 17:44:51 UTC
Does it still happen in Plasma 6.2?
Comment 9 alt 2024-11-08 08:46:18 UTC
(In reply to Nate Graham from comment #8)
> Does it still happen in Plasma 6.2?

Yes, still there
Comment 10 Nate Graham 2024-11-12 18:10:41 UTC
Can reproduce with over 100 icons on my system. Probably the threshold at which it starts to happen is dependent on the hardware, and maybe secondarily the contents or mimetypes of the icons.

Should be fixed with https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2628.
Comment 11 Akseli Lahtinen 2024-11-13 12:51:17 UTC
Git commit f7a92f7e65ac09cfd82a01835ac9f955c1b25744 by Akseli Lahtinen.
Committed on 13/11/2024 at 12:51.
Pushed by akselmo into branch 'master'.

FolderView: Performance improvements for selections

This MR has multiple changes, especially related to the "rubberband" (selection rectangle).

- Use `Qt.callLater` for `gridView.rectangleSelect` to eliminate redundant calls.
  - This was previously called *every time mouse moved one pixel*
- Clear a redundant mapToItem
  - `var cPos = mapToItem(gridView.contentItem, mouse.x, mouse.y);` needs to be only called during rubberband action
- Update dragItem images after selection is done, instead of every time a delegate is selected
- Instead of creating and destroying `selectionButton` in `FolderItemDelegate`, create it once and toggle its visibility


These all should help with the performance related to selecting multiple icons by dragging the selectiong rectangle around them.

M  +13   -17   containments/desktop/package/contents/ui/FolderItemDelegate.qml
M  +26   -9    containments/desktop/package/contents/ui/FolderView.qml
M  +5    -0    containments/desktop/plugins/folder/foldermodel.cpp
M  +1    -0    containments/desktop/plugins/folder/foldermodel.h

https://invent.kde.org/plasma/plasma-desktop/-/commit/f7a92f7e65ac09cfd82a01835ac9f955c1b25744