diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-01 14:21:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 18:21:27 +0000 |
commit | 30628288ce2b411ca3def46129a4606073e16bac (patch) | |
tree | 5cae447bc92895f5e16359741416e733458a15de /runtime/worker_bootstrap.rs | |
parent | dcf391ffed3850f9026d88b146e156375c4619d4 (diff) |
perf: lazily retrieve ppid (#18940)
This is very apparent on Windows.
Before: 45.74ms (Hello world)
After: 33.92ms
Closes #18939
Diffstat (limited to 'runtime/worker_bootstrap.rs')
-rw-r--r-- | runtime/worker_bootstrap.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 09725122c..ba894f52b 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -5,7 +5,6 @@ use deno_core::ModuleSpecifier; use std::thread; use crate::colors; -use crate::ops::runtime::ppid; /// Common bootstrap options for MainWorker & WebWorker #[derive(Clone)] @@ -61,7 +60,7 @@ impl BootstrapOptions { &self, scope: &mut v8::HandleScope<'s>, ) -> v8::Local<'s, v8::Array> { - let array = v8::Array::new(scope, 17); + let array = v8::Array::new(scope, 16); { let args = v8::Array::new(scope, self.args.len() as i32); @@ -143,17 +142,12 @@ impl BootstrapOptions { } { - let val = v8::Integer::new(scope, ppid() as i32); - array.set_index(scope, 11, val.into()); - } - - { let val = v8::String::new_external_onebyte_static( scope, env!("TARGET").as_bytes(), ) .unwrap(); - array.set_index(scope, 12, val.into()); + array.set_index(scope, 11, val.into()); } { @@ -163,7 +157,7 @@ impl BootstrapOptions { v8::NewStringType::Normal, ) .unwrap(); - array.set_index(scope, 13, val.into()); + array.set_index(scope, 12, val.into()); } { @@ -173,17 +167,17 @@ impl BootstrapOptions { v8::NewStringType::Normal, ) .unwrap(); - array.set_index(scope, 14, val.into()); + array.set_index(scope, 13, val.into()); } { let val = v8::Boolean::new(scope, self.inspect); - array.set_index(scope, 15, val.into()); + array.set_index(scope, 14, val.into()); } { let val = v8::Boolean::new(scope, self.enable_testing_features); - array.set_index(scope, 16, val.into()); + array.set_index(scope, 15, val.into()); } array |