Skip to content

Commit

Permalink
write-qt-apps-hook.sh: use make-binary-wrapper for significant speedups
Browse files Browse the repository at this point in the history
QT apps tend to call makeWrapper with a lot of arguments, which causes
noticable slowdowns (+100ms for app startup). The slow down boils down
to two reasons:

- the required string processing is O(N^2)
- bash is slow at doing the processing

By using the binary wrapper, we fix the second point, brining the
overhead down from 100ms to just 4ms or thereabouts.

I tested this change by rebuilding my whole system with it (I use
plasma). It booted and it works (that's where I type this commit
message), but I am not 100% sure if this won't break anything else.

Closes: #225871
  • Loading branch information
matklad committed Apr 12, 2023
1 parent 3fb8eed commit e8ce8af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-5/5.15/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ let

wrapQtAppsHook = makeSetupHook {
name = "wrap-qt5-apps-hook";
propagatedBuildInputs = [ self.qtbase.dev buildPackages.makeWrapper ]
propagatedBuildInputs = [ self.qtbase.dev buildPackages.makeBinaryWrapper ]
++ lib.optional stdenv.isLinux self.qtwayland.dev;
} ../hooks/wrap-qt-apps-hook.sh;
} // lib.optionalAttrs config.allowAliases {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ let
wrapQtAppsHook = makeSetupHook
{
name = "wrap-qt6-apps-hook";
propagatedBuildInputs = [ buildPackages.makeWrapper ];
propagatedBuildInputs = [ buildPackages.makeBinaryWrapper ];
} ./hooks/wrap-qt-apps-hook.sh;

qmake = makeSetupHook
Expand Down

0 comments on commit e8ce8af

Please sign in to comment.