diff options
author | Vincent Ambo <tazjin@tvl.su> | 2023-11-02T15·44+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-11-03T09·24+0000 |
commit | 99f618bcb4301c2265122d21bc00dbb1f148c37c (patch) | |
tree | 37f00d8207e2846801827a825ec9aa92b04cd9a2 | |
parent | 2dd2b844c72a3b8af2671651b7d59e50f6e1b048 (diff) |
refactor(tvix/eval): delay allocation when comparing attr values r/6932
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
-rw-r--r-- | tvix/eval/src/value/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index f5b373e3c4ef..9b6e522dd0a6 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -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? |