Repository navigation
minimal-bootstrap: only create one derivation for mes sources - #519568
Conversation
619f4ea to
d0c02a7
Compare
Gskartwii
left a comment
There was a problem hiding this comment.
Thanks, I forgot about this one! Maybe we could backport this for 26.05 eventually as well.
|
Ran # hello.drvPath
NIX_SHOW_STATS=1 NIX_SHOW_STATS_PATH=stats.json \
nix-instantiate --eval --strict -E '(import ./. {}).hello.drvPath' >/dev/null
# git.drvPath (matches the workload you used for the stats diff in the PR body)
NIX_SHOW_STATS=1 NIX_SHOW_STATS_PATH=stats.json \
nix-instantiate --eval --strict -E '(import ./. {}).git.drvPath' >/dev/null
# minimal NixOS system eval
NIX_SHOW_STATS=1 NIX_SHOW_STATS_PATH=stats.json \
nix-instantiate -I nixpkgs=. --eval -E '
let nixos = import ./nixos/lib/eval-config.nix {
modules = [ ./nixos/modules/profiles/minimal.nix
{ fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
boot.loader.grub.devices = ["/dev/sda"]; } ];
}; in nixos.config.system.build.toplevel.drvPath
' >/dev/null
|
| metric | baseline | optimized | delta | % change |
|---|---|---|---|---|
| nrFunctionCalls | 97,813 | 77,998 | -19,815 | -20.26% |
| nrPrimOpCalls | 73,311 | 62,418 | -10,893 | -14.86% |
| nrThunks | 199,897 | 165,812 | -34,085 | -17.05% |
| nrAvoided | 181,413 | 148,692 | -32,721 | -18.04% |
| nrLookups | 79,314 | 62,338 | -16,976 | -21.40% |
| nrOpUpdates | 30,583 | 19,078 | -11,505 | -37.62% |
| envs.number | 117,435 | 94,029 | -23,406 | -19.93% |
| envs.bytes | 2,406,864 | 1,958,400 | -448,464 | -18.63% |
| list.bytes | 480,976 | 348,600 | -132,376 | -27.52% |
| list.concats | 3,140 | 2,839 | -301 | -9.59% |
| sets.number | 49,920 | 35,586 | -14,334 | -28.71% |
| sets.bytes | 22,139,152 | 21,073,264 | -1,065,888 | -4.81% |
| values.number | 617,228 | 572,380 | -44,848 | -7.27% |
| values.bytes | 9,875,648 | 9,158,080 | -717,568 | -7.27% |
| gc.totalBytes | 41,019,680 | 36,679,856 | -4,339,824 | -10.58% |
git.drvPath
Details
| metric | baseline | optimized | delta | % change |
|---|---|---|---|---|
| nrFunctionCalls | 223,514 | 203,699 | -19,815 | -8.87% |
| nrPrimOpCalls | 134,443 | 123,550 | -10,893 | -8.10% |
| nrThunks | 489,459 | 455,374 | -34,085 | -6.96% |
| nrAvoided | 400,597 | 367,876 | -32,721 | -8.17% |
| nrLookups | 165,942 | 148,966 | -16,976 | -10.23% |
| nrOpUpdates | 68,084 | 56,579 | -11,505 | -16.90% |
| envs.number | 268,441 | 245,035 | -23,406 | -8.72% |
| envs.bytes | 5,888,704 | 5,440,240 | -448,464 | -7.62% |
| list.bytes | 834,944 | 702,568 | -132,376 | -15.85% |
| list.concats | 16,423 | 16,122 | -301 | -1.83% |
| sets.number | 103,502 | 89,168 | -14,334 | -13.85% |
| sets.bytes | 43,799,536 | 42,733,648 | -1,065,888 | -2.43% |
| values.number | 1,120,888 | 1,076,040 | -44,848 | -4.00% |
| values.bytes | 17,934,208 | 17,216,640 | -717,568 | -4.00% |
| gc.totalBytes | 78,052,080 | 73,715,600 | -4,336,480 | -5.56% |
Minimal NixOS system eval
Details
| metric | baseline | optimized | delta | % change |
|---|---|---|---|---|
| nrFunctionCalls | 4,269,608 | 4,229,978 | -39,630 | -0.93% |
| nrPrimOpCalls | 2,004,873 | 1,983,083 | -21,790 | -1.09% |
| nrThunks | 6,359,300 | 6,291,123 | -68,177 | -1.07% |
| nrAvoided | 5,203,535 | 5,138,090 | -65,445 | -1.26% |
| nrLookups | 2,985,154 | 2,951,197 | -33,957 | -1.14% |
| nrOpUpdates | 615,237 | 592,227 | -23,010 | -3.74% |
| envs.number | 5,058,305 | 5,011,490 | -46,815 | -0.93% |
| envs.bytes | 98,680,136 | 97,783,136 | -897,000 | -0.91% |
| list.bytes | 11,451,192 | 11,186,440 | -264,752 | -2.31% |
| list.concats | 174,304 | 173,702 | -602 | -0.35% |
| sets.number | 1,520,120 | 1,491,442 | -28,678 | -1.89% |
| sets.bytes | 211,369,568 | 209,236,400 | -2,133,168 | -1.01% |
| values.number | 9,605,698 | 9,515,923 | -89,775 | -0.93% |
| values.bytes | 153,691,168 | 152,254,768 | -1,436,400 | -0.93% |
| gc.totalBytes | 530,541,424 | 521,650,768 | -8,890,656 | -1.68% |
Wall-clock cpuTime (mean of N runs, same nix-instantiate invocations)
| workload | baseline (s) | optimized (s) | delta | % change |
|---|---|---|---|---|
hello.drvPath (n=5) |
0.2917 | 0.2654 | -0.0263 | -9.03% |
git.drvPath (n=5) |
0.5617 | 0.5111 | -0.0506 | -9.01% |
| Minimal NixOS system eval (n=3) | 3.4736 | 3.3883 | -0.0853 | -2.45% |
Co-authored-by: Aleksi Hannula <[email protected]>
The result of commonMeta is never actually needed if assertValidity goes away, and `.meta` is never accessed from the derivation. We perform a similar optimization in stdenv.mkDerivation.
f9f91c1 to
a733872
Compare
While I appreciate the intention, if you read the PR description, you can see I've already ran and shared a lot of the same stats. CI also gives an eval comparison for the whole tree. Coming into PR comments to paste the numbers is more distracting than helpful (at least for me). |
|
@llakala will keep that in mind for you in the future. Have collapsed them for now. For performance-related PRs I generally always run the same eval bench since different authors have different ways to evaluate reduction/improvements. |
pyrox0
left a comment
There was a problem hiding this comment.
Changes look good to me, and the eval time improvements are always welcome from my side.
|
LGTM. However, if this was made based on the PR you mentioned, then I think it's more appropriate to cherry-pick the commits from there and preserve authorship, and then add any further improvements on top. |
Can do if @Aleksanaa would like. IIRC, the original commit failed to build, and I needed to add changes on top of it - and I typically like each commit to be independently sane, which is why I chose to amend. |
|
Yeah you can amend those commits, that's fine, but just keep the co-authored-by line. |
|
Thanks!!! |
this was initially introduced in NixOS#494801 but accidentally reverted in NixOS#519568.
this was initially introduced in NixOS#494801 but accidentally reverted in NixOS#519568.
this was initially introduced in NixOS#494801 but accidentally reverted in NixOS#519568.
Patch from #496226, slightly modified to fix a build failure. I built gcc locally, and can confirm that even though the derivation hash differs, the output is identical. This will lead to a mass rebuild, but that's only because we don't have good content-addressed derivations.
Stats for
pkgs.gitsee an excellent improvement:{ "attrset": { "lookups": "-10.01%", "merges": "-16.67%", "mergeCopies": "-0.93%" }, "list": { "concats": "-1.83%" }, "parser": { "expressions": "+0.01%" }, "memory": { "envs": "-7.42%", "list": "-15.47%", "sets": "-2.03%", "symbols": "+0.01%", "values": "-3.65%", "total": "-2.98%" }, "speed": { "primops": "-8.02%", "functionCalls": "-8.68%", "thunksMade": "-6.49%", "thunksAvoided": "-7.91%" } }Eval stats typcally demonstrate that something has improved, but not to what degree. So here's hyperfine before:
And after:
Plugging this into 2PropZInt in a TI84, we get a p-value of
1.001 * 10^-10(or 0.0000000001001) for the null hypothesis. There could of course be other factors at play, but I have enough evidence to reject the null and conclude the alternative.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.