Repository navigation
Conversation
|
The commit I just pushed will be made redundant in a follow-up but I want to see ofBorg eval perf because @adisbladis suggested that even seemingly tiny changes can have an immense impact there because this is on the hot path for all packages. |
|
They have also provided an alternative implementation that has much nicer properties but trades off the ability to introspect. |
|
Hm, I have also realised that their approach trades off the ability to insert arbitrary custom constraints too as all constraints must be wrapped inside of a function that takes the platform as a parameter. This is an admittedly fringe case and could be remedied using a simple helper function around the custom constraint that applies the same wrapping. |
|
I'm far from an expert in interpreting these stats but the eval perf report appears to show a slight increase in function activity and thunks but a slight decrease in GC heap size? Anyhow, that's with the functionality not really in use by any packages yet. Real-world testing would likely prove to be difficult to realise. Perhaps we could migrate a critical mass of packages via automation somehow and extrapolate the effect. |
ede4b66 to
41a3da4
Compare
|
I did a quick and dirty hack by sed-patching the most common trivial cases of all, unix, linux++darwin, linux and darwin. Merge base: My PR with 12902 packages hacked: (also: wth, 13s eval for the minimal ISO‽ It was 6s on the previous merge base..) Sed script used: cmdline to hack: |
a0a5813 to
0e467a3
Compare
Previously, we were able to express platform constraints in packages using e.g.
meta.platforms = with lib.platforms; linux ++ darwin;
These platform checks only worked on a coarse level using lists of pre-defined
platform strings. It was not possible to express that only e.g. 64bit platforms
or that only GNU libcs are supported previously.
This introduces an algebra based on platform patterns which allows you to
express arbitrarily complex platform constraints using simple expressions
without needing to rely on `stdenv.*Platform.is*` bools.
Once this is in wide-spread use, it can be used for accurate rendering of
platform support in manuals and search sites.
It also removes the need for dependency on a package's `stdenv` for expressing
which platforms are broken as this can now be expressed using platform
constraints instead. This makes progress of potentially evaluating a package's
meta information independently of the package or its inputs.
It would be trivially possible to support platformConstraints in meta.platforms and meta.badPlatforms by simply replacing all occurrences of platformMatch with evalConstraint but that would require wrapping the platform constraints inside of a list when declaring them in packages which doesn't make a whole lot of sense given that they have native support for combining multiple conditions. It would be possible to allow lists or non-lists or even choose which method to use based on whether the value passed is a list but I think it's simpler if we just introduced a new meta attribute instead to make a clean cut between legacy platform declarations and platform constraints declaration.
This originally had some more opinionated changes and was based on an older state of my patches. I only kept the performance optimisations. I was not able to measure a significant change in perf but these look like they'd be better for perf to me and also improve the code. Co-authored-by: Atemu <[email protected]>
0e467a3 to
ead9589
Compare
|
In talking with @llakala about the current eval perf of the platforms check, I had the idea that we could declare platforms as a function like this: This declares the same meaning but is no longer dependent on the specific definitions in lib, so it could be substituted with a set of pre-computed values for e.g. |
|
They also suggested that we could just make the |
|
A conceptual difficulty I've just run into is that adding an attribute for memoisation causes false negatives platformMatch because it's just a dumb matchAttrs. But tbh. we have a custom data format here anyway, so we can just make it |
Previously, we were able to express platform constraints in packages using e.g.
These platform checks only worked on a coarse level using lists of pre-defined platform strings. It was not possible to express that only e.g. 64bit platforms or that only GNU libcs are supported previously.
This introduces an algebra based on platform patterns which allows you to express arbitrarily complex platform constraints using simple expressions without needing to rely on
stdenv.*Platform.is*bools.Once this is in wide-spread use, it can be used for accurate rendering of platform support in manuals and search sites.
It also removes the need for dependency on a package's
stdenvfor expressing which platforms are broken as this can now be expressed using platform constraints instead. This makes progress of potentially evaluating a package's meta information independently of the package or its inputs.Things we still need to discuss:
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.