From 33059de43112f6199b4d51f8757236eb5f717c13 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 6 Sep 2022 17:53:49 +0300 Subject: refactor(tvix/eval): cut down one iteration over locals array Caught by sterni in cl/6339 Change-Id: I2f2cd746114f14854cf599a7223a42a3e8ebe4fc Reviewed-on: https://cl.tvl.fyi/c/depot/+/6469 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/compiler/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tvix') diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index b6a3f329a0d6..af64953f88ab 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -807,8 +807,9 @@ impl Compiler<'_, '_> { } // Second pass to place the values in the correct stack slots. - let indices: Vec = entries.iter().map(|(idx, _)| *idx).collect(); + let mut indices: Vec = vec![]; for (idx, value) in entries.into_iter() { + indices.push(idx); self.compile(idx, value); // Any code after this point will observe the value in the -- cgit 1.4.1