Repository navigation
Conversation
|
Performance protector here - diff looks good on a readthrough. Once CI passes, I'm curious how much this will hurt our numbers. Hopefully not much, since we've already paid the toplevel cost of |
Yeah, I think this might not hurt much, if at all. We've already done the exact same checks previously. It is just that the point in the eval when we do it has shifted. Also note that since there isn't a handler defined at all they currently aren't even failing eval in this PR. Likely meaning they are even cheaper currently. We've to enable them for it to carry a cost. I'm also very much interested in keeping them cheap / making it cheaper to compute. I'll have to carve out some idea to measure the actual impact properly. Eval times are often very noisy in my experience. Perhaps forced thunk counts could be useful as a proxy metric. |
|
I've been working on automatically running perf inside our CI to count instructions. The Eval Summary page prints a lot of deterministic stats, but numbers like cpuTime vary a ton, and I'd like to get rid of them. The CI mechanisms already support running perf, I just need to finish adding the logic to our compare script. |
|
Also, I believe forced thunk counts is nrThunks in the eval summary. |
It seems like this is just counting created thunks: https://github.com/NixOS/nix/blob/master/src/libexpr/eval.cc#L974 I've some old hacky patches locally to get some more relevant numbers out of nix. Nothing pretty but perhaps a good starting point. |
|
Probably good to sync with #533181 |
This allows messages to be generated for a specific condition. For example we can tell users if a system is unsupported and which ones are supported. This is required to migrate e.g. the unsupported platform errors to the new meta.problems system.
This is helpful to make errors depend on the hostPlatform and the attributes in a package. One famous candidate is the `unsupported` platforms attribute that needs both the knowledge of the current nixpkgs hostPlatform and the packages meta.platforms attribute.
This moves the remediation message formatting functions into a separate file. The benefit is that we can now use this from multiple locations where similar/the same message must be generated without duplicating the format. The messages are well understood and if they are not improving one location should improve all of the cases where we emit them.. This will play into the `meta.problems` migration for legacy checks as they can much easier (and more consistently) emit the same (or at least very similar) message for failures.
This introduces the unsupported meta attribute from the legacy code to the new meta.problems. For backwards compatibility the environment variables and nixpkgs.config attributes work as they used to. Additionally we can now use the matcher infrastructure to enforce the platform checks. TODO: add the `unsupported` type to the default configuration so it fails eval.
This enabled the meta.problems `unsupported` error variant.
7811d2c to
7808463
Compare
| let | ||
| hasUnsupportedPlatform' = hasUnsupportedPlatform hostPlatform; | ||
| in | ||
| attrs: hasUnsupportedPlatform' attrs && !allowUnsupportedSystem; |
There was a problem hiding this comment.
Nit: if allowUnsupportedSystem is false, we can always avoid checking:
condition =
config:
if config.allowUnsupportedSystem || envAllowUnsupportedSystem then
_: _: false
else
hasUnsupportedPlatform|
did some initial measurments on thunk counts. It seems like for firefox this currently requires ~0.3% more thunk generation: I've played with some line-level thunk profiling counters and here are the current results: https://s.rammhold.de/nix-thunk-profile-baseline/ This currently tanks the Nix eval wallclock performance but should give reasonable numbers. Needs more testing tho.. Very first draft. |
This is moving the remediation messagesd into their dedicated file where all their (internal) utiltiy functions aren't cluttering the check-meta implementation and the remediation messages could potentially be emitted from other places in nixpkgs while keeping the styling the same. The driving motivation behind this is moving more checks into meta.problems and there we should very likely emit the messages in the same flavour users might be used to (either visually, by script or the wording). This was previously proposed as part of NixOS#545234 but is worthwhile on its own IMO.
This is moving the remediation messagesd into their dedicated file where all their (internal) utiltiy functions aren't cluttering the check-meta implementation and the remediation messages could potentially be emitted from other places in nixpkgs while keeping the styling the same. The driving motivation behind this is moving more checks into meta.problems and there we should very likely emit the messages in the same flavour users might be used to (either visually, by script or the wording). This was previously proposed as part of NixOS#545234 but is worthwhile on its own IMO.

Things done
This is the initial draft of migrating the
meta.platformschecks akaunsupported(platforms) into the new RFC127 stylemeta.problems.This is still missing support for
problems.nixisn't flexible enough yet. I'll work on that next.matchersfacilities to deal with unsupported platform attributes. The current configuration vianixpkgs.configand the environment variables are still supported. We likely need at least one release cycles before we can deprecate them (if we want that).This PR currently depends on #545182 as the test otherwise show false negatives when ran.
nix-build -A tests.problemsbuiltins.throwwarning when they are bing used (as authoritative override), then a failure and then rip them out for good in N+2 releases?