mirror of
https://github.com/NixOS/nix.git
synced 2025-12-14 04:51:05 +01:00
Add lazy evaluation for experimental feature reasons
Wrap fmt() calls in lambdas to defer string formatting until the feature check fails. This avoids unnecessary string formatting in the common case where the feature is enabled. Addresses performance concern raised by xokdvium in PR review.
This commit is contained in:
parent
39c4665488
commit
1b96a704d3
4 changed files with 23 additions and 6 deletions
|
|
@ -24,7 +24,8 @@ DownstreamPlaceholder DownstreamPlaceholder::unknownDerivation(
|
|||
OutputNameView outputName,
|
||||
const ExperimentalFeatureSettings & xpSettings)
|
||||
{
|
||||
xpSettings.require(Xp::DynamicDerivations, fmt("placeholder for unknown derivation output '%s'", outputName));
|
||||
xpSettings.require(
|
||||
Xp::DynamicDerivations, [&] { return fmt("placeholder for unknown derivation output '%s'", outputName); });
|
||||
auto compressed = compressHash(placeholder.hash, 20);
|
||||
auto clearText =
|
||||
"nix-computed-output:" + compressed.to_string(HashFormat::Nix32, false) + ":" + std::string{outputName};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue