diff options
author | Adam Joseph <adam@westernsemico.com> | 2023-11-25T09·38-0800 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-12-12T14·26+0000 |
commit | 72ece2e5184df7cb2099e54ace01154a4043d289 (patch) | |
tree | 7ad4cefb7973f0bbc10e1ff7edd2e5861b341119 /tvix/eval/src/vm/generators.rs | |
parent | 0c15a09b1589de8bbd7f843ec213147d5f089d73 (diff) |
feat(tvix/eval): nonrecursive nix_eq() r/7164
This commit rewrites Value::nix_eq() into an equivalent. 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 believed that the nonrecursive form would be faster. It is, in fact, slightly slower. I believe this is due to the vec![] allocation; I am investigating. Prev-Nixpkgs-Benchmark: {"attrpath":"pkgsCross.aarch64-multiplatform.hello.outPath","peak-kbytes":"459068","system-seconds":"0.71","user-seconds":"5.39"} This-Nixpkgs-Benchmark: {"attrpath":"pkgsCross.aarch64-multiplatform.hello.outPath","peak-kbytes":"460048","system-seconds":"0.68","user-seconds":"5.73"} Change-Id: I10f4868891e4b7475df13f0cbc41ec78dd985dd8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10118 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
Diffstat (limited to 'tvix/eval/src/vm/generators.rs')
-rw-r--r-- | tvix/eval/src/vm/generators.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tvix/eval/src/vm/generators.rs b/tvix/eval/src/vm/generators.rs index 1b6029e80710..3a256ec55d7e 100644 --- a/tvix/eval/src/vm/generators.rs +++ b/tvix/eval/src/vm/generators.rs @@ -288,7 +288,7 @@ impl<'o> VM<'o> { VMRequest::ForceValue(value) => { self.reenqueue_generator(name, span.clone(), generator); self.enqueue_generator("force", span.clone(), |co| { - value.force(co, span) + value.force_owned_genco(co, span) }); return Ok(false); } @@ -310,7 +310,7 @@ impl<'o> VM<'o> { let value = self.stack[self.with_stack[idx]].clone(); self.enqueue_generator("force", span.clone(), |co| { - value.force(co, span) + value.force_owned_genco(co, span) }); return Ok(false); @@ -327,7 +327,7 @@ impl<'o> VM<'o> { let value = call_frame.upvalues.with_stack().unwrap()[idx].clone(); self.enqueue_generator("force", span.clone(), |co| { - value.force(co, span) + value.force_owned_genco(co, span) }); return Ok(false); @@ -336,8 +336,8 @@ impl<'o> VM<'o> { VMRequest::NixEquality(values, ptr_eq) => { let values = *values; self.reenqueue_generator(name, span.clone(), generator); - self.enqueue_generator("nix_eq", span, |co| { - values.0.nix_eq(values.1, co, ptr_eq) + self.enqueue_generator("nix_eq", span.clone(), |co| { + values.0.nix_eq(values.1, co, ptr_eq, span) }); return Ok(false); } @@ -465,7 +465,7 @@ impl<'o> VM<'o> { ); self.enqueue_generator("force", span.clone(), |co| { - value.force(co, span) + value.force_owned_genco(co, span) }); return Ok(false); } |