From 91bd7ce73ab7eacaf995090014f67391624531c1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 6 Aug 2020 03:01:57 +0100 Subject: refactor(tvix): Use absl::btree_map for DerivationOutputs This container implementation is much faster than std::map. We have stuck to an ordered container because it's unclear whether the accesses of this field (of which there are *many*) are actually ordering dependent. Also includes an Arbitrary implementation for absl::btree_map (for any K, V that are also Arbitrary). Change-Id: I04f58ca0ce32b9ae1759313b01508b0e44bae793 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1683 Reviewed-by: glittershark Tested-by: BuildkiteCI --- third_party/nix/src/libstore/derivations.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'third_party/nix/src/libstore/derivations.cc') diff --git a/third_party/nix/src/libstore/derivations.cc b/third_party/nix/src/libstore/derivations.cc index 007c268bab..adfc6fc05f 100644 --- a/third_party/nix/src/libstore/derivations.cc +++ b/third_party/nix/src/libstore/derivations.cc @@ -40,8 +40,9 @@ BasicDerivation BasicDerivation::from_proto( result.builder = proto_derivation->builder().path(); store.assertStorePath(result.builder); - result.outputs.insert(proto_derivation->outputs().begin(), - proto_derivation->outputs().end()); + for (auto [k, v] : proto_derivation->outputs()) { + result.outputs.emplace(k, v); + } result.inputSrcs.insert(proto_derivation->input_sources().paths().begin(), proto_derivation->input_sources().paths().end()); -- cgit 1.4.1