1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 17:51:15 +02:00

encode black holes as tApp values

checking for isBlackhole in the forceValue hot path is rather more
expensive than necessary, and with a little bit of trickery we can move
such handling into the isApp case. small performance benefit, but under
some circumstances we've seen 2% improvement as well.

〉 nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'

before:

  Time (mean ± σ):      4.429 s ±  0.002 s    [User: 3.929 s, System: 0.500 s]
  Range (min … max):    4.427 s …  4.433 s    10 runs

after:

  Time (mean ± σ):      4.396 s ±  0.002 s    [User: 3.894 s, System: 0.501 s]
  Range (min … max):    4.393 s …  4.399 s    10 runs
This commit is contained in:
pennae 2023-12-10 08:24:45 +01:00
parent 0218e4e6c3
commit 78353deb02
7 changed files with 93 additions and 32 deletions

View file

@ -77,6 +77,14 @@ struct PrimOp
*/
std::optional<ExperimentalFeature> experimentalFeature;
/**
* Whether to hide this primop in diagnostics.
*
* Used to hide the fact that black holes are primop applications from
* stack traces.
*/
bool hideInDiagnostics;
/**
* Validity check to be performed by functions that introduce primops,
* such as RegisterPrimOp() and Value::mkPrimOp().