summaryrefslogtreecommitdiff
path: root/core/runtime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/runtime.rs')
-rw-r--r--core/runtime.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/runtime.rs b/core/runtime.rs
index 456dbe828..b9da06346 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -463,7 +463,6 @@ impl JsRuntime {
}
}
- let mut module_handles = vec![];
let mut scope = v8::ContextScope::new(scope, context);
// The 0th element is the module map itself, followed by X number of module
// handles. We need to deserialize the "next_module_id" field from the
@@ -476,6 +475,9 @@ impl JsRuntime {
info_data.length()
};
+ // Over allocate so executing a few scripts doesn't have to resize this vec.
+ let mut module_handles =
+ Vec::with_capacity(next_module_id as usize + 16);
for i in 1..=next_module_id {
match scope
.get_context_data_from_snapshot_once::<v8::Module>(i as usize)