summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-04-05 00:07:26 +0200
committerGitHub <noreply@github.com>2023-04-05 00:07:26 +0200
commit686fe477496cf6eee398eb8ac195692528d3f427 (patch)
tree350766faa10dcf436d49a12598e6098895a39107
parentc4628aa8090f2ec1a5a7616a987c653d0bfd6341 (diff)
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.
-rw-r--r--core/runtime.rs5
1 files changed, 3 insertions, 2 deletions
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).