+34
−35
Loading
listToAttrs forces every list element to extract `.name`, calling merge
eagerly for the entire union of attribute names (~60k). mapAttrs already
knows the keys; the lambda is only invoked when a key is selected,
letting the 99.7% unforced ones stay as untouched thunks.
NIX_SHOW_STATS delta on pkgsCross.aarch64-multiplatform.hello.drvPath:
nrFunctionCalls: 567,512 -> 507,404 (-10.6%)
nrThunks: 613,138 -> 552,356 (-9.9%)
sets.number: 158,787 -> 98,339 (-38.1%)
list.elements: 295,085 -> 174,189 (-41.0%)
gc.totalBytes: 117.5M -> 111.7M (-4.9%)
Repro:
NIX_SHOW_STATS=1 nix-instantiate --eval \
-E '(import ./. {}).pkgsCross.aarch64-multiplatform.hello.drvPath' \
2>stats.json >/dev/null
jq . stats.json