You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrapper scripts for plasma apps such as krunner or plasma-emojier are slow. For example, executing just the wrapper for plasma-emojier takes 100ms on my fast machine.
The reason for slowness is that the wrapper itself repeatedly adds various paths:
and makeWrapper then faithfully translates each --prefix, instead of pre-computing thee concatenation.
Steps To Reproduce
# Strip the `exec` line
$ <$(which plasma-emojier) head -n -1 > wrapper.sh && chmod a+x ./wrapper.sh
# Time the execution of the wrapper itself
$ time ./wrapper.shreal 0m0.117s 😱user 0m0.115ssys 0m0.002s
Expected behavior
Wrapper itself shouldn't take more than a handful of milliseconds. It seems achievable if I manually replace incremental quadratic addition to environmental variables with setting them once.
Not sure what's the best fix here, some options I see are:
fix wrap-qt-apps-hook to pre-concatenate variables and pass just a single --prefix argument per variable to wrapProgram
make wrapProgram itself smarter and teach it to collate identical prefixes
fix wrap-qt-apps-hook to use --set rather then --prefix
As I don't know bash, I don't plan on working on the fix myself
Describe the bug
Wrapper scripts for plasma apps such as
krunner
orplasma-emojier
are slow. For example, executing just the wrapper forplasma-emojier
takes 100ms on my fast machine.The reason for slowness is that the wrapper itself repeatedly adds various paths:
This leads to quadratic behavior. Profiling with perf shows that the bulk of the time is spend in string manipulation routines.
The relevant logic is here:
nixpkgs/pkgs/development/libraries/qt-6/hooks/wrap-qt-apps-hook.sh
Line 43 in 07ab967
Essentially, we are calling
and
makeWrapper
then faithfully translates each--prefix
, instead of pre-computing thee concatenation.Steps To Reproduce
Expected behavior
Wrapper itself shouldn't take more than a handful of milliseconds. It seems achievable if I manually replace incremental quadratic addition to environmental variables with setting them once.
Not sure what's the best fix here, some options I see are:
wrap-qt-apps-hook
to pre-concatenate variables and pass just a single--prefix
argument per variable towrapProgram
wrapProgram
itself smarter and teach it to collate identical prefixeswrap-qt-apps-hook
to use--set
rather then--prefix
As I don't know bash, I don't plan on working on the fix myself
Notify maintainers
cc @ttuegel
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: