Bug 473798

Summary: List of wallpapers takes ~3 seconds to load
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: Image WallpaperAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: nate, notmart, qydwhotmail
Priority: NOR Keywords: qt6
Version: master   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.27.8
Sentry Crash Report:

Description Patrick Silva 2023-08-27 11:18:15 UTC
STEPS TO REPRODUCE
1. right-click on desktop and choose "Configure desktop and wallpaper..."
2. maximize the window
3. click on any section in the left side
4. click on "Wallpaper" section

OBSERVED RESULT
List of wallpapers takes ~3 seconds to load

EXPECTED RESULT
List of wallpapers loads immediately

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.240.0
Qt Version: 6.6.0
Graphics Platform: Wayland
Comment 1 Nate Graham 2023-08-29 20:06:03 UTC
Can basically reproduce. It's not 3 seconds for me, but it's noticeably slow.
Comment 2 Fushan Wen 2023-08-30 00:37:15 UTC
How many wallpapers do you have?
Comment 3 Patrick Silva 2023-08-30 01:31:48 UTC
(In reply to Fushan Wen from comment #2)
> How many wallpapers do you have?

42
Comment 4 Bug Janitor Service 2023-08-30 08:17:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3229
Comment 5 Fushan Wen 2023-08-30 08:30:06 UTC
Can anyone confirm https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3229 fixes the bug? I personally can reproduce the bug with dozens of wallpapers neither before nor after applying the patch, but in theory the patch should make the dialog open faster.
Comment 6 Bug Janitor Service 2023-08-30 17:19:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3232
Comment 7 Fushan Wen 2023-08-30 17:21:28 UTC
Git commit 17f63b8fc5a808f6231c83ecbd9c1376c42b748d by Fushan Wen.
Committed on 30/08/2023 at 19:04.
Pushed by fusionfuture into branch 'master'.

wallpapers/image: don't add files/folders to KDirWatch again in proxy model

which leads to unnecessary duplicate watched items because KDirWatch
already monitors those files/folders by monitoring their parent folder
in customPaths.
FIXED-IN: 5.27.8

M  +12   -7    wallpapers/image/plugin/autotests/test_imageproxymodel.cpp
M  +40   -77   wallpapers/image/plugin/model/imageproxymodel.cpp
M  +8    -6    wallpapers/image/plugin/model/imageproxymodel.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/17f63b8fc5a808f6231c83ecbd9c1376c42b748d
Comment 8 Fushan Wen 2023-08-30 17:25:57 UTC
Git commit 1c23150b14776e8d1d0d84c2a5a44c3205968d78 by Fushan Wen.
Committed on 30/08/2023 at 19:12.
Pushed by fusionfuture into branch 'Plasma/5.27'.

wallpapers/image: don't add files/folders to KDirWatch again in proxy model

which leads to unnecessary duplicate watched items because KDirWatch
already monitors those files/folders by monitoring their parent folder
in customPaths.
FIXED-IN: 5.27.8

(cherry picked from commit 17f63b8fc5a808f6231c83ecbd9c1376c42b748d)

M  +12   -7    wallpapers/image/plugin/autotests/test_imageproxymodel.cpp
M  +39   -77   wallpapers/image/plugin/model/imageproxymodel.cpp
M  +8    -6    wallpapers/image/plugin/model/imageproxymodel.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/1c23150b14776e8d1d0d84c2a5a44c3205968d78
Comment 9 Fushan Wen 2023-08-31 11:23:36 UTC
Git commit dc4a5648bc9c12ce32cba31b97348f3577b8eeef by Fushan Wen.
Committed on 31/08/2023 at 13:11.
Pushed by fusionfuture into branch 'master'.

wallpapers/image: use versionless import in config dialog

According to qmlprofiler, this can slightly reduce the compilation time.

M  +3    -4    wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml
M  +4    -4    wallpapers/image/imagepackage/contents/ui/WallpaperDelegate.qml
M  +8    -8    wallpapers/image/imagepackage/contents/ui/config.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/dc4a5648bc9c12ce32cba31b97348f3577b8eeef
Comment 10 Bug Janitor Service 2023-08-31 13:19:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/279
Comment 11 Bug Janitor Service 2023-08-31 15:27:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kdeclarative/-/merge_requests/214
Comment 12 Bug Janitor Service 2023-08-31 15:43:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kcmutils/-/merge_requests/165
Comment 13 Fushan Wen 2023-09-01 01:11:37 UTC
Git commit 0068222cf64877f109c8f23feb7906e11d09b7dd by Fushan Wen.
Committed on 01/09/2023 at 03:09.
Pushed by fusionfuture into branch 'master'.

GridDelegate: lazy load menu

The menu is only used for keyboard navigation, so no need to always load
it. This speeds up the compilation of GridDelegate.

M  +18   -30   src/qml/components/GridDelegate.qml
A  +35   -0    src/qml/components/private/GridDelegateMenu.qml     [License: LGPL(v2.0+)]

https://invent.kde.org/frameworks/kcmutils/-/commit/0068222cf64877f109c8f23feb7906e11d09b7dd
Comment 14 Fushan Wen 2023-09-01 01:21:24 UTC
Git commit 91eb28e53233b97031163faf126f361d235b6500 by Fushan Wen.
Committed on 01/09/2023 at 03:17.
Pushed by fusionfuture into branch 'kf5'.

GridDelegate: lazy load menu

The menu is only used for keyboard navigation, so no need to always load
it. This speeds up the compilation of GridDelegate.

(cherry picked from commit 0068222cf64877f109c8f23feb7906e11d09b7dd)

M  +19   -27   src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml
A  +32   -0    src/qmlcontrols/kcmcontrols/qml/private/GridDelegateMenu.qml     [License: LGPL(v2.0+)]

https://invent.kde.org/frameworks/kdeclarative/-/commit/91eb28e53233b97031163faf126f361d235b6500
Comment 15 Bug Janitor Service 2023-09-01 06:56:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/knewstuff/-/merge_requests/273
Comment 16 Fushan Wen 2023-09-01 17:16:48 UTC
Git commit 2c77155c583a734f2f63e76842399eab37f35b0a by Fushan Wen.
Committed on 01/09/2023 at 19:06.
Pushed by fusionfuture into branch 'master'.

Button: don't compile NewStuff.Dialog on the first load

When Loader.sourceComponent is set, QML engine will precompile the
component even if the Loader is not active. This reduces the compilation
time by about 15% (400ms -> 300ms).

M  +24   -30   src/qtquick/qml/Button.qml

https://invent.kde.org/frameworks/knewstuff/-/commit/2c77155c583a734f2f63e76842399eab37f35b0a
Comment 17 Bug Janitor Service 2023-09-02 19:39:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3245
Comment 18 Fushan Wen 2023-09-07 03:06:15 UTC
Git commit 0f91327c650991f71803276f992981244329ab43 by Fushan Wen.
Committed on 07/09/2023 at 04:50.
Pushed by fusionfuture into branch 'master'.

wallpapers/image: lazy load image model and slide model

1. Make sure the image model and the slide model are only created
   when necessary, so the slide model will not consume resource when the
   image plugin is used, and vice versa.
2. When used in a config dialog, the model is created only after the
   component is completely created, which means all bindings are properly
   set. This avoids some unnecessary work.

M  +67   -32   wallpapers/image/plugin/imagebackend.cpp
M  +9    -6    wallpapers/image/plugin/imagebackend.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/0f91327c650991f71803276f992981244329ab43
Comment 19 Fushan Wen 2023-09-11 15:48:52 UTC
Git commit 436d456bef16ed30a4f8bfbda93d0cb42d7808b9 by Fushan Wen.
Committed on 10/09/2023 at 01:32.
Pushed by fusionfuture into branch 'master'.

Lazy load MobileTextActionsToolBar

In most cases desktop users won't need it, and according to qmlprofiler,
compiling MobileTextActionsToolBar.qml usually takes about 50~100ms
depending on the hardware and disk speed. After this change, the
compilation only takes 10~20ms, which significantly speeds up the opening
speed of config dialogs.

M  +7    -66   org.kde.desktop/private/MobileTextActionsToolBar.qml
C  +9    -21   org.kde.desktop/private/MobileTextActionsToolBarImpl.qml [from: org.kde.desktop/private/MobileTextActionsToolBar.qml - 050% similarity]

https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/436d456bef16ed30a4f8bfbda93d0cb42d7808b9