Repository navigation
Description
Describe the bug
I recently upgraded from NixOS 24.05 to 24.11 and performed a fresh install of Plasma 6. While using Plasma, I've observed that programs run noticeably slower compared to the GNOME environment.
The issue is significantly worse when it is on energy-saving mode, which takes an unusually long time.
After getting suggestions from Matrix, I'm opening issue about this, becuase it may be a way to speedup the startup/launch time.
This issue probably covers the following issues:
- Excessively long environment variables in kde plasma #126590
- KDE 5 applications are slow #21345 (I hope this may be re visitable, it has some proposals)
Thank you.
Steps To Reproduce
Steps to reproduce the behavior:
- Install NixOS 24.11 with each GNOME and KDE Plasma(6) system in virtual machine.
- Add
strace, kdePackages.kcalcpackage in configuration.nix on both system, AddkdePackages.fullin plasma system. - Run following:
strace --summary --timestamps=unix,ms -o log kcalc & (sleep 20 && pkill kcalc)- This runs
kcalc, and then after 20s, killskcalcprocess.
- This runs
- Compare the timestamp with first line and
memfd_create("wayland-shm", MFD_CLOEXEC|MFD_ALLOW_SEALING)from log- I assume this is the time when windows are going to create and then rendered.
The benchmarks are following, which is the kcalc application's startup time:
- GNOME: 6.8s
- Plasma: 12.69s
Expected behavior
The application startup may really fast. I believe this can be improved.
Screenshots
If this require need more screenshots/videos, I'll add it.
Here is a comparison of running zeditor and kcalc in Performance mode. In Energy Saving Mode, the difference is dramatically worse.
a.mp4
Additional context
-
When running in Performance,
kcalcruns in about 5 seconds or less, but when running in Energy Saving mode, it takes more than 10 seconds. -
After discovering this delay, I enabled the memory cache. Since I had a lot of RAM, so I set the following options
vm.vfs_cache_pressure=1, vm.swappiness=1, Although it's not fixed, it does make for a faster startup slightly. -
Each virtual machine has following spec: 1vCore, 4GB or RAM, 20GB qcow2 sata from host with nvme ssd.
-
At first I thought full disk encryption may long startup, but I'm not using FDE anymore so this would be not a main issue.
Metadata
- host
sob@t14:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 6.12.1, NixOS, 24.11 (Vicuna), 24.11.20241203.b681065`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.24.10`
- nixpkgs: `/nix/store/w66xaybnxjf5zhxapxs3pd3zp7gxk9dw-source`
- Processor:
8 × Intel® Core™ i5-10210U CPU @ 1.60GHz RAM 50.2 GB
Notify maintainers
Mentioning plasma-workspace maintainers: @ilya-fedin @K900 @LunNova @mjm @NickCao @SuperSandro2000 @ttuegel
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.


Activity
ilsubyeega commentedon Jan 15, 2025
I've been investigating for a couple of days, and although it's far from perfect, here's what I found.
I have very little experience with the C/C++ ecosystem and could be wrong. So, if you have any mismentions, please send feedback.
For investigation, I got the following results via
catch syscall openall/accesscommand ingdb.Qt side:
QFactoryLoader::update, a fs syscall is made.QPlatformThemeFactory::create -> QLibraryPrivate::loadPlugin)QTranslatorloads all of language(of all kde programs), although the application does not related.KDE side:
https://github.com/KDE/kiconthemes/blob/42e40aca1eed2db51114f1d7dd2689989a56851c/src/kicontheme.cpp#L361-L365
Other things:
libglvndaccess every directories for library searching.QFontconfigDatabase::populateFontDatabase)To conclude, I don't know what I can do on Nix related work to fix the Qt-specific issue out of box.
I wonder if there is something like directory caching in Qt library[1]. There were cases where there was no directory above level 2, but it was searched.
[1]: It has, but i don't think that thing works well, maybe it's only file hit caching? https://doc.qt.io/qt-6/qfileinfo.html#performance-considerations
SuperSandro2000 commentedon Jan 15, 2025
related to #126590
ilsubyeega commentedon Mar 2, 2025
For now, I gave up using KDE plasma. Just some information, I can reduce the fontconfig load overhead by reducing fonts (had installed
google-fontswhich is really huge font base)nixos-discourse commentedon Mar 14, 2025
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/why-nixos-has-consistently-worse-cpu-performance-compared-to-ubuntu/61677/9
alexjp commentedon May 20, 2025
@ilsubyeega Maybe you can try/test this solution I am testing: https://github.com/alexjp/env-dedup
It should clean up duplicate variables (at least it does here, seems to work and is fast, but haven't tested it thoroughly).
ilsubyeega commentedon May 21, 2025
@alexjp
I've tried at fresh installation of NixOS 25.05 Plasma, It does not seems to be worked as expected. (maybe I might be wrong that plasma was pretty slow as default)
Did compile dynamic libraries and then append
LD_PRELOADto system environment.Just in case, try using
QT_DEBUG_PLUGINS=1for verbose qt log.alexjp commentedon May 21, 2025
@ilsubyeega
Strange. Can you test
env | wcor any other duplicate checker, with and without it?BTW... I saw that you were on Linux x86-64, that was where you did the test, right? I have yet to do compatibility with other systems.
I did tried it here and didn't catch any duplicate search of directories.
I am using nushell, my testing example is:
QT_DEBUG_PLUGINS=1 konsole | complete | get stderr | lines | find -n "checking directory path" | uniq -d0x53A commentedon Mar 8, 2026
super-T blocks the whole desktop, every time, not just the first, for around 2 seconds.
I've run strace and asked Claude to analyse the trace.
the result is:
Details
KDE Plasma Tiling (Super+T) Performance Bug on NixOS
Summary
Pressing Super+T to open the KDE Plasma tiling editor causes a ~2-7 second freeze of the entire compositor. The root cause is 260,530
statx()syscalls, of which 259,948 return ENOENT, as KWin searches through 81 nix store paths inXDG_DATA_DIRSfor theme files.This happens every time, not just on first use. It's a NixOS-specific issue caused by the long
XDG_DATA_DIRScontaining a store path for every KDE dependency.Environment
Reproduction
Analysis
Tracing command
Then press Super+T during the 15-second window.
Syscall breakdown for main thread (pid 1954)
statx()dominates at 260K calls out of ~268K total syscalls.Almost all stat calls fail with ENOENT
99.97% of the
statx()calls return "No such file or directory".81 unique nix store paths are searched
What the stat calls look like
For each theme file (e.g.
translucent/colors), KWin walks every store path inXDG_DATA_DIRS:Files that do exist (like
button.svgz) are also stat'd multiple times redundantly:Timeline from first trace (network/ipc only)
An earlier trace with
-e trace=network,ipcrevealed the 7.5s gap more clearly since it only captured IPC:Root Cause
On NixOS,
XDG_DATA_DIRScontains a store path for every KDE-related package (81 in this case). When libplasma looks up a theme file, it searches through each$dir/share/plasma/desktoptheme/...path sequentially. With hundreds of theme files to resolve and 81 paths to search for each, this results in 260Kstatx()calls.On a conventional distro,
XDG_DATA_DIRStypically contains just/usr/shareand/usr/local/share, so the same lookup requires ~2 stat calls per file instead of ~81.Two sub-problems compound the issue:
button.svgz) are stat'd 6+ times redundantlySuperSandro2000 commentedon Mar 8, 2026
Run the following as part of /etc/profile
erolm-a commentedon Mar 16, 2026
Deduplicating does not help the cause (at least, for me).
In my environment very few variables are repeated, no blowup happens, and yet using any QML-based app (which is almost the entirety of plasma, or the Bismuth script etc.) causes may calls to stat(). The suggested hacks (#126590 (comment) and #126590 (comment)) to put all libraries in
XDG_DATA_DIRSwork but to some extent, depending on where the xdgdata derivation ends up in the search path (and often does not contain the app's own libraries, of course). And won't help with QML, as another variable is used (NIXPKGS_QT6_QML_IMPORT_PATHI believe). For example, the lag when opening the mixer tray has got down from 2s to 1s, but on traditional FHS-compliant systems it should be way less than 1s. If the laptop battery goes to 10%, the lag can get up to 3s. If the system changes theme (which it does from dark to light and vice versa 2 times a day) it freezes for 5s.This is so bad on laptops (ironically following KDE's powerdevil policies) I have decided to completely switch away from KDE, which is a shame because I love the project.
Besides, I don't think it's a good architectural decision to rely on a FS cache to tell you whether a file exists or not. First, because it requires a syscall anyway (which eats user time), and secondly because it is a leaky abstraction that is not even always true. And clearly, Qt's
QFileInfocache is not working as intended.That being said: I personally think this is an issue with Qt's design (and yes I have read #86369 ). I don't really have a solution that would work well with nixos, but only some ideas:
ilsubyeega commentedon Mar 16, 2026
i believe dedupe wont give great performance but noticable for some users, it still scans each directories(resources etc), still no idea what approach would really work at all.
this could be fixed in nixpkgs side(do symlink farming, or explicitly set symlinked resources path each wrapper), but 90% sure qt/upstream can improve their strategy to figure out where plugin and resources are.
16 remaining items
erolm-a commentedon Aug 18, 2026
EDIT, but if my understanding is not wrong, every GTK app basically ships with its own index of used assets that is made available byglib-compile-schemas. For runtime-only dependencies they instead rely ondconf. Again, I never worked on GTK.EDIT again: basically some special plugins like IM, printers rely on special caching to avoid searching on
GTK_PATHevery time but just once. But for others it's just pure enumeration..K900 commentedon Aug 18, 2026
That's not entirely correct in a bunch of ways that actually matter here.
ilya-fedin commentedon Aug 18, 2026
If you mention that in the context of
desktoptheme/default/translucent/colorsthen I have to upset you, that's not a Qt plugin, it just attempts to find a textual colorscheme config like https://invent.kde.org/plasma/libplasma/-/blob/master/src/desktoptheme/breeze-light/colorsilya-fedin commentedon Aug 18, 2026
Given the files in libplasma repo, using breeze light/breeze dark instead of just breeze could be a workaround (theoretically)
c3r5b8 commentedon Aug 18, 2026
Yes
Breeze Light
Breeze
c3r5b8 commentedon Aug 18, 2026
I found another hack
But it breaks theme preview in setting and requires rebuilding whole plasma (on my ryzen 7 5700x3d it took 40 minutes)
nixos/yuki: add KDE Plasma KDE XDG_DATA_DIRS hack
MagicRB commentedon Aug 31, 2026
For ZFS users:
I've been fighting random lockups and general sluggishness for a while. The best way to reproduce it that me and @ElvishJerricco found was PrismLauncher. Opening it, clicking on the "Settings" button, then closing the window would take take 10 seconds on a system with 2 1tb HDDs in raid1 + l2arc and slog on an NVME SSD. We concluded that the reason why PrismLauncher was slow as hell is due to openzfs/zfs#13446 which also manifests with flatpak (openzfs/zfs#11140) and was originally introduced in openzfs/zfs#4276.
@robn provided a patch which disables
O_TMPFILEon ZFS, which you can apply on NixOS like so (don't forget to adapt to your specific kernel version, ZFS version and patch file location):with the above applied, PrismLauncher settings menu closes instantly, KDE boots in 5 seconds not 20 and krunner is also instant. There is a slight freeze during
switch-to-configurationstill, but it also went from very noticeable to barely perceptible.The patch provided by robn applies cleanly to master (i think), for 2.4.3 you need zfs-disable-tmpfile.patch. Both patches should be safe as they merely disable a feature, which the VFS will work around if not available, or will return not supported to userspace if it cannot.
ElvishJerricco commentedon Sep 1, 2026
For the record, this was particularly noticeable because the entire system ran on a ZFS pool with HDDs in it. If you're not using ZFS, obviously this is not related to anything you're experiencing. And if you're running on SSD(s), I can't say with confidence that this same problem would be noticeable to you. Experience reports on whether that patch makes a noticeable difference for SSD+ZFS users would be helpful. Note: @MagicRB was using SSDs for SLOG and L2ARC, just not for main vdevs. But these were irrelevant because the linked ZFS bug is about
O_TMPFILEbypassing the ZIL (and therefore SLOG) entirely, which destroys the performance of thef(data)syncoperations typically done alongsideO_TMPFILE(more accurately, it destroys the performance of thelinkatthat comes after because thef(data)syncwas ignored and has to be compensated with a full async TXG commit duringlinkat). Bypassing the ZIL would hurt performance on any pool, not just HDD pools or ones with SLOG, so this may still be a problem on SSD pools. It's just hard to say; it could be that this ZFS bug is unrelated to all of the experiences in this thread because it's only significant with HDDs, or it could be that the bug is pretty noticeable in any pool.(As an aside: There's a very minor security consideration with disabling
O_TMPFILE. It's used to create files with no name in the file system so that no other processes can open it. But unix permissions can keep other users from opening files created withoutO_TMPFILE, and processes using same user as your process can open your process'sO_TMPFILEfile descriptors anyway using/proc/$your_pid/fd/$fd. So realistically, the security concern here is practically nothing)MagicRB commentedon Sep 1, 2026
Regarding the specific PrismLauncher manifestation, i do see it also on my (ssd) laptop, instead of being 10 seconds its just 0.5 seconds. So i do believe there is something to be gained here in general. And as an added point, i never relied on krunner even on my laptop because it would sometimes just take a hot second to open. However since patching my desktop, it opens instantly there, always.
usr40k commentedon Sep 1, 2026
another thing to note is the first launch of krunner will always take more time or if your krunner shuts down completely after each use, krunner (atleast on openSUSE) remains open (but hidden) for faster subsequent launches. So the very first launch will always take longer than any subsequent launch. (assuming krunner was not already running)
n0099 commentedon Sep 1, 2026
Based on #363068 (comment)
This zfs patch targeting 2.4.4 and only overlaying
config.boot.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}like #473637 (comment) as userlandzfs-utilsshouldn't need this:* patching zfs kernel module following openzfs/zfs#11140 (comment) as N…
jackboykin commentedon Sep 24, 2026
I opened an upstream MR for the
colorslookups https://invent.kde.org/frameworks/ksvg/-/merge_requests/119jackboykin commentedon Oct 21, 2026
A fix, though partial and not all-encompassing, has been merged which should take care of the
colorspain. Due in KF 6.32 https://invent.kde.org/frameworks/ksvg/-/merge_requests/120