Nix 2.6 eval improvement

Tags
Nix
Updated at
Jan 25, 2022 11:09 PM
Published at
January 25, 2022

With the recent Nix 2.6 release, I was curious about how much impact all of @pennae’s work was having on the Nix evaluation.

TL;DR: Nix evaluation is 11-17% faster in Nix 2.6 compared to Nix 2.5.1

Methodology

I have both the nix and nixpkgs repo side by side.

nixpkgs is checked out at ac44b27bab615fd49bc94fe22124deae233b5c94 (latest master)

nix is checked out at 2.6.0

Then run nix-build pkgs/top-level/release.nix -A metrics and collect the output.

For nix 2.5.1 I added a space change to pkgs/top-level/metrics.nix to force the rebuild on my machine.

For nix 2.6 I injected the version from the nix repo:

diff --git a/pkgs/top-level/metrics.nix b/pkgs/top-level/metrics.nix
index d413b881eaa..cf065697923 100644
--- a/pkgs/top-level/metrics.nix
+++ b/pkgs/top-level/metrics.nix
@@ -2,11 +2,17 @@
 
 with pkgs;
 
+let
+  nix = (import ../../../nix).defaultPackage.${pkgs.system};
+in
+

Then I took all the results and painstakingly inserted them in Notion, for your pleasure and mine:

nix-build pkgs/top-level/release.nix -A metrics

attr
2.5.1
2.6.0
Diff %
nixos.smallContainer.time

1.02288 s

0.861962 s

NaN
nixos.mallContainer.maxresident

480160 KiB

458036 KiB

NaN
nixos.smallContainer.allocations

280278984 B

270314728 B

NaN
nixos.smallContainer.values

3341438

3243496

2.974729890990555
nixos.kde.time

1.96151 s

1.74307 s

NaN
nixos.kde.maxresident

572032 KiB

560300 KiB

NaN
nixos.kde.allocations

422864776 B

409517776 B

NaN
nixos.kde.values

5314604

5188433

2.4025622303339498
nixos.lapp.time

1.62311 s

1.43888 s

NaN
nixos.lapp.maxresident

560988 KiB

550420 KiB

NaN
nixos.lapp.allocations

363063272 B

349837776 B

NaN
nixos.lapp.values

4697517

4572023

2.7076640264781204
nix-env.qa.time

8.62761 s

7.51825 s

NaN
nix-env.qa.maxresident

2199724 KiB

2220716 KiB

NaN
nix-env.qa.allocations

1589209632 B

1533671496 B

NaN
nix-env.qa.values

13927806

14326969

2.8254551664276217
nix-env.qaDrv.time

58.0178 s

54.589 s

NaN
nix-env.qaDrv.maxresident

6430276 KiB

6558340 KiB

NaN
nix-env.qaDrv.allocations

8828388424 B

8641514600 B

NaN
nix-env.qaDrv.values

101913915

101689635

0.2203105004799769
nix-env.qaCount

38784

38784

0
nix-env.qaCountBroken

2666

2666

0
nix-env.qaAggressive.time

8.57256 s

7.62719 s

NaN
nix-env.qaAggressive.maxresident

2199728 KiB

2220736 KiB

NaN
nix-env.qaAggressive.allocations

1589209632 B

1533671496 B

NaN
nix-env.qaAggressive.values

13927806

14326969

2.8254551664276217
nix-env.qaDrvAggressive.time

57.418 s

54.3827 s

NaN
nix-env.qaDrvAggressive.maxresident

6429816 KiB

6558460 KiB

NaN
nix-env.qaDrvAggressive.allocations

8828388424 B

8641514600 B

NaN
nix-env.qaDrvAggressive.values

101913915

101689635

0.2203105004799769
loc

2341615

2341619

0.00017082212846934405