From 99f618bcb4301c2265122d21bc00dbb1f148c37c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 2 Nov 2023 18:44:21 +0300 Subject: 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 Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/eval/src/value/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tvix') 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? -- cgit 1.4.1