stdenv: Remove extra merge operator in meta#430132
Conversation
This operator merges two attrsets without any conditions, and leads to more operations and allocations.
|
I've decided to remove all merges that don't involve user input, and filter resulting attributes in one |
pkgs/stdenv/generic/check-meta.nix
Outdated
There was a problem hiding this comment.
unused; you made use of builtins.removeAttrs below.
There was a problem hiding this comment.
Yep, change got stuck in my stage. Fixed now.
There was a problem hiding this comment.
Will be good to merge once this is removed again as it is unused 😁
803adcd to
9b7148e
Compare
|
The version with
All time metrics are worse, and we trade ~1 MiB of attrsets for ~0.5 MiB of lists. |
9b7148e to
b679ba6
Compare
|
With null attr names trick metrics seem even better, thanks @philiptaron! Everything went down:
|
philiptaron
left a comment
There was a problem hiding this comment.
One trivial change then let's merge.
pkgs/stdenv/generic/check-meta.nix
Outdated
There was a problem hiding this comment.
Will be good to merge once this is removed again as it is unused 😁
Remove usage of filterAttrs and two more attrset merges. Saves more time and memory.
b679ba6 to
60d2cc0
Compare
|
@philiptaron Ah, it slipped through again. Removed. |
|
What if we do the same for mkDerivation?.. #430969 |
As in NixOS#430132, it saves a lot of set allocations and merge operations, but makes code harder to read. I've tried introducing a function like this to make code cleaner, but it increases number of envs and space taken by them significantly: optionalAttr = cond: name: if cond then name else null; I've also tried applying this logic to the section with isDarwin, but it makes things measurably worse for x86_64-linux eval.
This operator merges two attrsets without any conditions, and leads to more operations and allocations.
Extract from the Eval / compare job summary:
All these metrics went down, all other metrics didn't change.
Especially note -2% of CPU and -3% of GC time, -2.7% of sets and -2.4% of update ops.
Things done
Add a 👍 reaction to pull requests you find important.