aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-20 04:26:03 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-06-22 06:56:47 -0700
commit9e4c11e280fbafc1140d6c283d214cb5a9d7ee1e (patch)
tree97d3c782bfa543632bbfc3d851588e712a3aa35d
parent7f836f2d7380a415bf7da6b038c159329f8f2947 (diff)
downloadbun-9e4c11e280fbafc1140d6c283d214cb5a9d7ee1e.tar.gz
bun-9e4c11e280fbafc1140d6c283d214cb5a9d7ee1e.tar.zst
bun-9e4c11e280fbafc1140d6c283d214cb5a9d7ee1e.zip
Preallocate some event loop tasks
-rw-r--r--src/javascript/jsc/javascript.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/javascript/jsc/javascript.zig b/src/javascript/jsc/javascript.zig
index 52f70a263..66d84fddb 100644
--- a/src/javascript/jsc/javascript.zig
+++ b/src/javascript/jsc/javascript.zig
@@ -395,6 +395,7 @@ pub const VirtualMachine = struct {
if (!this.has_enabled_macro_mode) {
this.has_enabled_macro_mode = true;
this.macro_event_loop.tasks = EventLoop.Queue.init(default_allocator);
+ this.macro_event_loop.tasks.ensureTotalCapacity(16) catch unreachable;
this.macro_event_loop.global = this.global;
this.macro_event_loop.virtual_machine = this;
this.macro_event_loop.concurrent_tasks = EventLoop.Queue.init(default_allocator);
@@ -498,7 +499,9 @@ pub const VirtualMachine = struct {
VirtualMachine.vm.regular_event_loop.tasks = EventLoop.Queue.init(
default_allocator,
);
+ VirtualMachine.vm.regular_event_loop.tasks.ensureUnusedCapacity(64) catch unreachable;
VirtualMachine.vm.regular_event_loop.concurrent_tasks = EventLoop.Queue.init(default_allocator);
+ VirtualMachine.vm.regular_event_loop.concurrent_tasks.ensureUnusedCapacity(8) catch unreachable;
VirtualMachine.vm.event_loop = &VirtualMachine.vm.regular_event_loop;
vm.bundler.macro_context = null;