But, after short investigation, it seems that the problem might be on the Nix side actually? Profiing the startup shows that a lot time is spent in the following stack trace:
Still rebuilding the world to check if that’d break, but, from what I can tell, it wouldn’t help. makeBinaryWrapper has the same quadratic behavior for repeated --prefix arguments:
Look at this! It actually does fix the issue! I believe it is still O(N^2), but the actual runtime is only 5ms. That’s surprising, I would’ve expect bash to do more or less what the C code does anyway.
I am “afraid” to try this, as it rebuilds webengine… (any way to disable qtwebengine from plasma??)
I have noticed (very much, since I do it all the time) also that launching apps through shortcuts also feels slow (ex: starting konsole through plasma keyboard shortcut feels slower than just clicking on icon or launching from terminal )… hope this fixes it
Ohh … thanks for the input… then it must be another issue.
Its not like the global shortcuts are slow, but that 100ms you mentioned, that seemed it.
I notice it from switching from gentoo or arch, but its not something like 10 seconds or something that is easy to catch and show.
Anyway…
As a test, what I did was, using your wrapper.sh, opened a bash session which I sourced the env from wrapper.sh.
Then I launched .konsole-wrapped (with full path) directly, and benchmarked it with hyperfine.
Then did the same for using normal konsole bin (with full path).
EDITED: It seems the wrapper.sh is reponsable here for about 50~60ms. (I also hyperfined wrapper.sh directly, which showed more or less the same time).
The reason why it feels snappy for me is that I don’t use global application shortcuts (which are slow), but rather pin apps in taskbar and use Win+1, Win+2, etc (which are surprisingly faster).
saw your reply on kde bug report, doesn’t kstart take 330ms because it segfaults at the end?
i get around that same time because of the segfault at the end, i think. ( I get 40ms in gentoo, and around 80ms in arch )
( btw a good test to check between using meta+1/2/3/etc and kglobalaccell, is just shimming kstart and put a sleep 1 or 2 seconds before calling the real kstart. the meta+1/2/3/etc aren’t affected, but normal shortcuts are )
EDIT: clarification, seems the segfault only happens when kstart --help for example, not when running a valid command, so I guess the question above is answered