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

attr2.5.12.6.0Diff %
1.02288 s
0.861962 s
NaN
480160 KiB
458036 KiB
NaN
280278984 B
270314728 B
NaN
3341438
3243496
2.974729890990555
1.96151 s
1.74307 s
NaN
572032 KiB
560300 KiB
NaN
422864776 B
409517776 B
NaN
5314604
5188433
2.4025622303339498
1.62311 s
1.43888 s
NaN
560988 KiB
550420 KiB
NaN
363063272 B
349837776 B
NaN
4697517
4572023
2.7076640264781204
8.62761 s
7.51825 s
NaN
2199724 KiB
2220716 KiB
NaN
1589209632 B
1533671496 B
NaN
13927806
14326969
2.8254551664276217
58.0178 s
54.589 s
NaN
6430276 KiB
6558340 KiB
NaN
8828388424 B
8641514600 B
NaN
101913915
101689635
0.2203105004799769
38784
38784
0
2666
2666
0
8.57256 s
7.62719 s
NaN
2199728 KiB
2220736 KiB
NaN
1589209632 B
1533671496 B
NaN
13927806
14326969
2.8254551664276217
57.418 s
54.3827 s
NaN
6429816 KiB
6558460 KiB
NaN
8828388424 B
8641514600 B
NaN
101913915
101689635
0.2203105004799769
2341615
2341619
0.00017082212846934405