about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-15T19·51+0100
committertazjin <mail@tazj.in>2020-07-16T00·37+0000
commitd8ee0afda9c6947eb9477b7bfe0cec81628ef2fe (patch)
tree41dbbe33e6ba86ab1af8c74fc643f1c90aab9278
parent5cd7cf93fc6b6b58b05f579866a89bf22c6eacab (diff)
refactor(3p/nix): Compare attribute sets by pointer equality r/1306
Paired-With: Perry Lorier <isomer@tvl.fyi>
Change-Id: I418e9127c5d9d31559c59e461f17726ddbc051c4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1180
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
-rw-r--r--third_party/nix/src/libexpr/eval.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc
index 56e4006204..a834e097a5 100644
--- a/third_party/nix/src/libexpr/eval.cc
+++ b/third_party/nix/src/libexpr/eval.cc
@@ -1667,6 +1667,12 @@ bool EvalState::eqValues(Value& v1, Value& v2) {
       return true;
 
     case tAttrs: {
+      // As an optimisation if both values are pointing towards the
+      // same attribute set, we can skip all this extra work.
+      if (v1.attrs == v2.attrs) {
+        return true;
+      }
+
       /* If both sets denote a derivation (type = "derivation"),
          then compare their outPaths. */
       if (isDerivation(v1) && isDerivation(v2)) {