feat(3p/nix): Statically pass bindings capacity where possible
To aid in making the decision of where to (currently just statically) use a vector or btree as the backing implementation, add an extra constructor argument to Bindings::NewGC for a capacity, and use a (currently hardcoded at 32, for no good reason other than it felt like a reasonable number) pivot to switch between our possible backing implementations. Then, update all the call sites where it feels reasonable that we know the capacity statically to *pass* that capacity to the constructor. Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: I1858c161301a1cd0e83aeeb9a58839378869e71d Reviewed-on: https://cl.tvl.fyi/c/depot/+/1124 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: isomer <isomer@tvl.fyi>
This commit is contained in:
parent
d5505fcff9
commit
d5597b4784
5 changed files with 39 additions and 31 deletions
4
third_party/nix/src/libexpr/eval.cc
vendored
4
third_party/nix/src/libexpr/eval.cc
vendored
|
|
@ -1240,9 +1240,9 @@ void ExprOpUpdate::eval(EvalState& state, Env& env, Value& dest) {
|
|||
|
||||
state.nrOpUpdates++;
|
||||
|
||||
state.mkAttrs(dest, /* capacity = */ 0);
|
||||
state.mkAttrs(dest, v1.attrs->size() + v2.attrs->size());
|
||||
|
||||
/* Merge the sets, preferring values from the second set. */
|
||||
// Merge the sets, preferring values from the second set.
|
||||
dest.attrs->merge(*v1.attrs);
|
||||
dest.attrs->merge(*v2.attrs);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue