From 686fe477496cf6eee398eb8ac195692528d3f427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 5 Apr 2023 00:07:26 +0200 Subject: refactor(core): run pending dynamic imports before ops (#18592) This is in preparation to limit number of times we have to cross Rust -> V8 boundary on each tick of event loop. --- core/runtime.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/runtime.rs b/core/runtime.rs index 89487bc6c..70b1f7bc7 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1205,8 +1205,6 @@ impl JsRuntime { self.pump_v8_message_loop()?; - // Ops - self.resolve_async_ops(cx)?; // Dynamic module loading - ie. modules loaded using "import()" { // Run in a loop so that dynamic imports that only depend on another @@ -1232,6 +1230,9 @@ impl JsRuntime { } } } + + // Ops + self.resolve_async_ops(cx)?; // Run all next tick callbacks and macrotasks callbacks and only then // check for any promise exceptions (`unhandledrejection` handlers are // run in macrotasks callbacks so we need to let them run first). -- cgit v1.2.3