diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-02-22 01:55:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-22 06:25:31 +0530 |
commit | 4c6db7aa1493139f5a832c1e9ebfe44a1c80af80 (patch) | |
tree | 758a1e2b21fce29ac82bee66973853d75de8f950 /runtime/worker_bootstrap.rs | |
parent | 5becfd6381889287ff16a064128021f87c8dfcb6 (diff) |
perf(core, runtime): Further improve startup time (#17860)
This commit further improves startup time by:
- no relying on "JsRuntime::execute_script" for runtime bootstrapping,
this is instead done using V8 APIs directly
- registering error classes during the snapshot time, instead of on
startup
Further improvements can be made, mainly around removing
"core.initializeAsyncOps()" which takes around 2ms.
This commit should result in ~1ms startup time improvement.
Diffstat (limited to 'runtime/worker_bootstrap.rs')
-rw-r--r-- | runtime/worker_bootstrap.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 5563b6ead..12abceca6 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -58,8 +58,8 @@ impl Default for BootstrapOptions { } impl BootstrapOptions { - pub fn as_json(&self) -> String { - let payload = json!({ + pub fn as_json(&self) -> serde_json::Value { + json!({ // Shared bootstrap args "args": self.args, "cpuCount": self.cpu_count, @@ -80,7 +80,6 @@ impl BootstrapOptions { "v8Version": deno_core::v8_version(), "userAgent": self.user_agent, "inspectFlag": self.inspect, - }); - serde_json::to_string_pretty(&payload).unwrap() + }) } } |