about summary refs log tree commit diff
path: root/tvix/eval/src/value/thunk.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-29T15·27+0300
committertazjin <tazjin@tvl.su>2022-09-06T16·54+0000
commita8c13a5ce1ee59c82b9138cc2073ab1b26187d00 (patch)
tree915a1d6a0d6f7293f106088f55198d01fc3ec6b0 /tvix/eval/src/value/thunk.rs
parent6c895d4b280e6376e833cec80a387c0729b898a3 (diff)
fix(tvix/eval): allocate Thunk::upvalues with known capacity r/4682
The capacity (i.e. number of builtins) is known from the lambda, so we
can size it correctly right away.

Change-Id: Iab0b5a3f47d450fa9866c091ebbbed935b934907
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6351
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to '')
-rw-r--r--tvix/eval/src/value/thunk.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/eval/src/value/thunk.rs b/tvix/eval/src/value/thunk.rs
index 3b7cb7f5f7..9d52ded3c4 100644
--- a/tvix/eval/src/value/thunk.rs
+++ b/tvix/eval/src/value/thunk.rs
@@ -51,8 +51,8 @@ pub struct Thunk(Rc<RefCell<ThunkRepr>>);
 impl Thunk {
     pub fn new(lambda: Rc<Lambda>) -> Self {
         Thunk(Rc::new(RefCell::new(ThunkRepr::Suspended {
+            upvalues: Vec::with_capacity(lambda.upvalue_count),
             lambda,
-            upvalues: vec![],
         })))
     }
 }