From e8151ed27210ba36df05ec058d2fc512f9211756 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Tue, 16 Jul 2019 18:13:46 +0300 Subject: [PATCH] Optimize pushing the stack --- src/runner.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/runner.rs b/src/runner.rs index bcc1853..4e05e74 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -1289,12 +1289,9 @@ impl FunctionContext { debug_assert!(!self.is_initialized); let num_locals = locals.iter().map(|l| l.count() as usize).sum(); - let locals = vec![Default::default(); num_locals]; - - // TODO: Replace with extend. - for local in locals { + for _ in 0..num_locals { value_stack - .push(local) + .push(Default::default()) .map_err(|_| TrapKind::StackOverflow)?; }