From edbd5055a1c3ca429b4c58d23f140a9fb76c3fc8 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 8 Dec 2023 02:46:38 -0800 Subject: feat(tvix/eval): nonrecursive nix_cmp_ordering(), fixes b/339 This commit rewrites Value::nix_cmp_ordering() into an equivalent nonrecursive form. Except for calls to Thunk::force(), the new form no longer uses generators, and is async only because of the fact that it calls Thunk::force(). I originally believed that this commit would make evaluation faster. In fact it is slightly slower. I believe this is due to the added vec![] allocation. I am investigating. Prev-Nixpkgs-Benchmark: {"attrpath":"pkgsCross.aarch64-multiplatform.hello.outPath","peak-kbytes":"460048","system-seconds":"0.68","user-seconds":"5.73"} This-Nixpkgs-Benchmark: {"attrpath":"pkgsCross.aarch64-multiplatform.hello.outPath","peak-kbytes":"460224","system-seconds":"0.67","user-seconds":"5.84"} Change-Id: Ic627bc220d9c5aa3c5e68b9b8bf199837cd55af5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10212 Reviewed-by: tazjin Tested-by: BuildkiteCI Autosubmit: Adam Joseph --- tvix/eval/src/vm/macros.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tvix/eval/src/vm/macros.rs') diff --git a/tvix/eval/src/vm/macros.rs b/tvix/eval/src/vm/macros.rs index 8a536ee4664d..34e94bb5fa74 100644 --- a/tvix/eval/src/vm/macros.rs +++ b/tvix/eval/src/vm/macros.rs @@ -42,7 +42,8 @@ macro_rules! cmp_op { async fn compare(a: Value, b: Value, co: GenCo) -> Result { let a = generators::request_force(&co, a).await; let b = generators::request_force(&co, b).await; - let ordering = a.nix_cmp_ordering(b, co).await?; + let span = generators::request_span(&co).await; + let ordering = a.nix_cmp_ordering(b, co, span).await?; Ok(Value::Bool(cmp_op!(@order $op ordering))) } -- cgit 1.4.1