-
-
Notifications
You must be signed in to change notification settings - Fork 17.5k
stdenv: Remove extra merge operator in meta #430132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused; you made use of builtins.removeAttrs below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, change got stuck in my stage. Fixed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One trivial change then let's merge.
pkgs/stdenv/generic/check-meta.nix
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.