diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-07-12T21·29-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-07-13T23·50+0000 |
commit | d5597b4784e04020b4ef4968a6887d4e22cc3edd (patch) | |
tree | 5c1a4760e6f1fe78d43b287d361c61db0060217b /third_party/nix/src/libexpr/get-drvs.cc | |
parent | d5505fcff9dc9ad76b4cb822cc642fdd0e238553 (diff) |
feat(3p/nix): Statically pass bindings capacity where possible r/1285
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>
Diffstat (limited to 'third_party/nix/src/libexpr/get-drvs.cc')
-rw-r--r-- | third_party/nix/src/libexpr/get-drvs.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/third_party/nix/src/libexpr/get-drvs.cc b/third_party/nix/src/libexpr/get-drvs.cc index 875c8ca2a0eb..d21e8ba896ca 100644 --- a/third_party/nix/src/libexpr/get-drvs.cc +++ b/third_party/nix/src/libexpr/get-drvs.cc @@ -294,7 +294,7 @@ bool DrvInfo::queryMetaBool(const std::string& name, bool def) { void DrvInfo::setMeta(const std::string& name, Value* v) { getMeta(); Bindings* old = meta; - meta = Bindings::NewGC(); + meta = Bindings::NewGC(old->size()); Symbol sym = state->symbols.Create(name); if (old != nullptr) { for (auto i : *old) { |