refactor(tvix/eval): delay allocation when comparing attr values

Delays allocation (through cloning) of the values to be compared
until *after* the keys have been compared.

Change-Id: I7d68c27d7a0fbcdcc387db7c092bce50ca4b94ea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9900
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2023-11-02 18:44:21 +03:00 committed by clbot
parent 2dd2b844c7
commit 99f618bcb4

View file

@ -505,8 +505,8 @@ impl Value {
return Ok(Value::Bool(false));
}
let iter1 = a1.into_iter_sorted();
let iter2 = a2.into_iter_sorted();
let iter1 = a1.iter_sorted();
let iter2 = a2.iter_sorted();
for ((k1, v1), (k2, v2)) in iter1.zip(iter2) {
if k1 != k2 {
@ -515,8 +515,8 @@ impl Value {
if !generators::check_equality(
&co,
v1,
v2,
v1.clone(),
v2.clone(),
std::cmp::max(ptr_eq, PointerEquality::AllowNested),
)
.await?