thunk values are shareable, and we can represent invalid/uninitialized values with a special bit pattern that makes no sense otherwise. there is no need to keep allocating values on the heap, instead we can treat values like reference-counted smart pointers to heap objects, which in turn lets us save a lot of allocations and, ultimately, gc heap space. compared to our baseline (main of 2025-09-27) we save 15%+ memory on a system rebuild and 17% on nix search. eval time regresses by ~3% for a system rebuild, while nix search is 7% faster. further optimization is probably possible (but for now this will just have to be good enough). Change-Id: Ib6c47acdbe2fac4f76a83c2269f16f30ef66b2e1
27 lines
658 B
C++
27 lines
658 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include "lix/libexpr/symbol-table.hh"
|
|
#include "lix/libexpr/value.hh"
|
|
|
|
namespace nix {
|
|
|
|
/**
|
|
* Print a value in the deprecated format used by `nix-instantiate --eval` and
|
|
* `nix-env` (for manifests).
|
|
*
|
|
* This output can't be changed because it's part of the `nix-instantiate` API,
|
|
* but it produces ambiguous output; unevaluated thunks and lambdas (and a few
|
|
* other types) are printed as Nix path syntax like `<CODE>`.
|
|
*
|
|
* See: https://github.com/NixOS/nix/issues/9730
|
|
*/
|
|
void printAmbiguous(
|
|
const Value & v,
|
|
const SymbolTable & symbols,
|
|
std::ostream & str,
|
|
std::set<const void *> * seen,
|
|
int depth
|
|
);
|
|
}
|