Skip to content
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

Fixes for overrideAttrs (split from #201734) #211685

Merged
merged 5 commits into from
Feb 3, 2023

Conversation

Artturin
Copy link
Member

@Artturin Artturin commented Jan 20, 2023

Description of changes

Fixes from #201734 that don't come with a significant performance impact.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@roberth roberth changed the title split easy parts out of #201734 Fixes for overrideAttrs (split from #201734) Jan 20, 2023
@roberth
Copy link
Member

roberth commented Jan 20, 2023

The report looks great! The relevant numbers are all <1%. (And ignore cpuTime as always, although I wish -10% was true)

If you could add some tests in pkgs.tests, this lgtm.

@@ -16,17 +16,22 @@ let
# This function introduces `overridePythonAttrs` and it overrides the call to `buildPythonPackage`.
makeOverridablePythonPackage = f: origArgs:
let
ff = f origArgs;
overrideWith = newArgs: origArgs // (if pkgs.lib.isFunction newArgs then newArgs origArgs else newArgs);
args = lib.fix (lib.extends
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By inlining fix and extends, and then simplifying the expression, you'll improve performance, but the gain will be marginal, as the performance stats indicate that this addition is in fact quite cheap. Readability is more important for now, as you're still working on this code.

@Artturin Artturin force-pushed the splicingstuff1-split branch 3 times, most recently from 5eb8237 to d3db1cc Compare January 20, 2023 17:07
// shouldn't be used when overrideAttrs is available

here we can use extends instead of overrideAttrs for performance
only outputs the first failing test atm
@Artturin Artturin marked this pull request as ready for review January 30, 2023 17:06
@Artturin Artturin merged commit dcc7df7 into NixOS:staging Feb 3, 2023
@Artturin Artturin deleted the splicingstuff1-split branch February 3, 2023 10:49
roberth added a commit to hercules-ci/nixpkgs that referenced this pull request Feb 27, 2023
The effect of `.out // { outputSpecified = false; }` in these cases
is to select the default output explicitly, but then make the
selection implicit until `overrideAttrs` is called. Previously
`overrideAttrs` would not preserve output selection, masking the
apparently unnecessary behavior of this workaround.

For `libllvm-polly`, this logic does not apply, as it does not
select the default output.

The `outputSpecified` workaround was introduced in
NixOS#122554

and was perhaps rushed because of a release deadline, and expected
delays from mass rebuilds.

The change in `overrideAttrs` behavior was added in
5b2f597 / NixOS#211685

and the problem was discovered in NixOS#218537,
which may contain further information.
alyssais pushed a commit that referenced this pull request Feb 28, 2023
The effect of `.out // { outputSpecified = false; }` in these cases
is to select the default output explicitly, but then make the
selection implicit until `overrideAttrs` is called. Previously
`overrideAttrs` would not preserve output selection, masking the
apparently unnecessary behavior of this workaround.

For `libllvm-polly`, this logic does not apply, as it does not
select the default output.

The `outputSpecified` workaround was introduced in
#122554

and was perhaps rushed because of a release deadline, and expected
delays from mass rebuilds.

The change in `overrideAttrs` behavior was added in
5b2f597 / #211685

and the problem was discovered in #218537,
which may contain further information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants