refactor(3p/nix): Compare attribute sets by pointer equality
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>
This commit is contained in:
parent
5cd7cf93fc
commit
d8ee0afda9
1 changed files with 6 additions and 0 deletions
6
third_party/nix/src/libexpr/eval.cc
vendored
6
third_party/nix/src/libexpr/eval.cc
vendored
|
@ -1667,6 +1667,12 @@ bool EvalState::eqValues(Value& v1, Value& v2) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case tAttrs: {
|
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"),
|
/* If both sets denote a derivation (type = "derivation"),
|
||||||
then compare their outPaths. */
|
then compare their outPaths. */
|
||||||
if (isDerivation(v1) && isDerivation(v2)) {
|
if (isDerivation(v1) && isDerivation(v2)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue