Bug 476627

Summary: Loading of large directories abnormally slow after update
Product: [Applications] dolphin Reporter: Mircea Kitsune <sonichedgehog_hyperblast00>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: asturm, kfm-devel, sonichedgehog_hyperblast00, thefeeltrain, thwrnr0
Priority: NOR    
Version: 23.08.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: fstab
hdparm

Description Mircea Kitsune 2023-11-06 15:10:52 UTC
Created attachment 162900 [details]
fstab

SUMMARY
Large directories are now taking a ridiculous amount of time to load in Dolphin. A folder with over 65.000 images would previously take roughly 15 seconds to finish loading, now it’s over 5 minutes. During this time I see 100% of one CPU core being used, however I can’t find a root or user process doing it and it’s not the Dolphin application itself… my hard drive keeps being read at a rate of roughly 3 MB/s.

This only happens once per directory after boot, after a directory finishes showing up it will load at normal speed until you reboot... this indicates the problem may be related to caching. It’s definitely not a problem with my drive and was introduced by a recent update, other operations such as using the 'ls' command are just as fast only Dolphin appears to be affected.

STEPS TO REPRODUCE
You need a directory with a lot of files to see it clearly, at least 50.000 if possible: Open it and the issue should be quickly noticeable. A good test folder that's typically large for most users is  ~/.cache/thumbnails/large where preview thumbnails are cached by the system, opening that should trigger it if you have a lot of previews.

OBSERVED RESULT
The directory takes minutes to load as Dolphin is barely responsive during the process.

EXPECTED RESULT
Over a month ago it would only take a few seconds, something clearly changed affecting directory loading speeds on Dolphin or some KDE component exclusively.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11
Kernel Version: 6.6.0-1-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 570 Series

ADDITIONAL INFORMATION
Attached /etc/fstab as it's been previously pointed out Dolphin had issues with certain parameters there. The affected partition is a SATA3 HDD, I'm also able to reproduce it on my SSD where loading a large directory with lots of images is abnormally slow as well... both are ext4. No drive errors, booted with "fsck.mode=force fsck.repair=yes" to make extra sure and the issue persists even afterward. Baloo is enabled but the affected directories are not indexed. Enabling or disabling previews in Dolphin doesn't make any difference. Extra discussion of the issue on the Manjaro Linux forum:

https://forum.manjaro.org/t/dolphin-loading-of-large-directories-very-slow-after-update/149727
Comment 1 Mircea Kitsune 2023-11-06 15:14:02 UTC
Created attachment 162901 [details]
hdparm

Output of "hdparm -Tt /dev/sda" which is the main affected drive: It shows that my usual drive read / write speeds are normal and this isn't an issue with my HDD, which is confirmed by the fact that other applications who work with lots of files or large files work just as fast and only Dolphin appears to be abnormally slowed down.
Comment 2 Andreas Sturmlechner 2023-11-24 13:53:59 UTC
Confirmed on Gentoo with dolphin-23.08.3. Downgrading to 23.04.3 fixed the problem for me, so it is definitely some change in 23.08 branch.

Operating System: Gentoo Linux 2.14
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.112.0
Qt Version: 5.15.11
Kernel Version: 5.10.198-gentoo (64-bit)
Graphics Platform: X11
Comment 3 Mircea Kitsune 2024-05-29 20:58:52 UTC
After months of struggling with this issue it seems that today, after installing the latest Manjaro stable snapshot, this issue finally ceased: I opened large directories I use preemptively to load them after login, and noticed that instead of 10 minutes of slow loading their contents appeared in 5 seconds. I'd like to take some time to ensure it's permanent and the slowness never happens again before concluding it's solved for good but for now it appears to be.

I wonder what in KDE has been causing it all this time, or whether it was a different system component doing it: The only obvious change is an upgrade from Kernel 6.9.0 to 6.9.2, if it was the kernel the fix happened in 6.9.1 or 6.9.2. The switch from Plasma 5 to 6 was a few weeks back but even then the issue continued until today.
Comment 4 Mircea Kitsune 2024-06-10 16:30:39 UTC
Waited another update cycle to be safe, the issue appears to remain resolved. Setting as such and will reopen if it ever returns.