summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-03-08 22:21:14 +0530
committerGitHub <noreply@github.com>2023-03-08 22:21:14 +0530
commit0cce9c2bcc9667935a571d30847e66ef5d01a196 (patch)
tree3e188f47a7c8350a3f48fe5ec3a0b256351d41b9 /runtime/worker.rs
parent06a12341c66e0a44436e1178603e0f398bfae10c (diff)
feat(core): prevent isolate drop for CLI main worker (#18059)
``` Benchmark 1: deno run -A ../empty.js Time (mean ± σ): 20.5 ms ± 0.5 ms [User: 13.4 ms, System: 5.1 ms] Range (min … max): 19.8 ms … 24.0 ms 119 runs Benchmark 2: target/release/deno run -A ../empty.js Time (mean ± σ): 18.8 ms ± 0.3 ms [User: 13.0 ms, System: 4.9 ms] Range (min … max): 18.3 ms … 19.9 ms 129 runs ``` --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r--runtime/worker.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs
index e624cb2b4..42ff6b0f9 100644
--- a/runtime/worker.rs
+++ b/runtime/worker.rs
@@ -141,6 +141,7 @@ pub struct WorkerOptions {
/// `WebAssembly.Module` objects cannot be serialized.
pub compiled_wasm_module_store: Option<CompiledWasmModuleStore>,
pub stdio: Stdio,
+ pub leak_isolate: bool,
}
impl Default for WorkerOptions {
@@ -177,6 +178,7 @@ impl Default for WorkerOptions {
startup_snapshot: Default::default(),
bootstrap: Default::default(),
stdio: Default::default(),
+ leak_isolate: false,
}
}
}
@@ -304,6 +306,7 @@ impl MainWorker {
extensions_with_js: options.extensions_with_js,
inspector: options.maybe_inspector_server.is_some(),
is_main: true,
+ leak_isolate: options.leak_isolate,
..Default::default()
});