fix(tvix/eval): allocate Thunk::upvalues with known capacity

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>
This commit is contained in:
Vincent Ambo 2022-08-29 18:27:06 +03:00 committed by tazjin
parent 6c895d4b28
commit a8c13a5ce1

View file

@ -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![],
})))
}
}