nix-installer icon indicating copy to clipboard operation
nix-installer copied to clipboard

nix 2.23.3 run cache performance regression

Open mjgallag opened this issue 1 year ago • 5 comments

Reruns are much slower in nix 2.23.3 then in nix 2.21.1 so you may want to reconsider it being your currently recommended version, see https://github.com/NixOS/nix/issues/11193.

nix 2.21.1
nix run nixpkgs/2122a9b35b35719ad9a395fe783eabb092df01b1#cowsay hi  0.10s user 0.02s system 46% cpu 0.264 total
nix 2.23.3
nix run nixpkgs/2122a9b35b35719ad9a395fe783eabb092df01b1#cowsay hi  2.07s user 0.47s system 40% cpu 6.238 total

mjgallag avatar Jul 26 '24 15:07 mjgallag

FWIW I was able to reproduce the performance regression in 2.21.1:

$ command time nix run github:nixos/nixpkgs/2122a9b35b35719ad9a395fe783eabb092df01b1#cowsay hi
 ____
< hi >
 ----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
0.04user 0.00system 0:02.46elapsed 2%CPU (0avgtext+0avgdata 21248maxresident)k
1819inputs+0outputs (0major+3367minor)pagefaults 0swaps
$ nix --version
nix (Nix) 2.21.1

so I think it's mostly unrelated to 2.23.3.

cole-h avatar Jul 26 '24 16:07 cole-h

Interesting, I definitely see a stark difference, perhaps easier to detect on my ancient 8 year old mac ha ha. In any case it seems 2.23.4 may resolve it, see https://github.com/NixOS/nix/issues/11193#issuecomment-2253054157.

mjgallag avatar Jul 26 '24 16:07 mjgallag

If you want to verify, the merge commit for the original PR that was backported is cached I believe, so nix shell github:nixos/nix/8ce4287409319e04f46ed1352deb956c30e35fc6 and then use that nix to nix run .... However, I was able to reproduce the slow performance issue at least once on that merge commit :shrug:

cole-h avatar Jul 26 '24 16:07 cole-h

It appears 2.23.4 resolves the issue.

nix run github:nixos/nix/051f3773db212ad46f347ce586a241152a43180f -- --version
warning: unknown experimental feature 'repl-flake'
nix (Nix) 2.23.4
time nix run github:nixos/nix/051f3773db212ad46f347ce586a241152a43180f -- run nixpkgs/2122a9b35b35719ad9a395fe783eabb092df01b1#cowsay hi
warning: unknown experimental feature 'repl-flake'
 ____ 
< hi >
 ---- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
nix run github:nixos/nix/051f3773db212ad46f347ce586a241152a43180f -- run  hi  0.19s user 0.04s system 41% cpu 0.542 total

mjgallag avatar Jul 26 '24 18:07 mjgallag

This has been fixed in https://github.com/NixOS/nix/pull/11086

sambacha avatar Jul 31 '24 10:07 sambacha