From b3d7df55357ea6fc6f5141b64a9638ddb39b0f63 Mon Sep 17 00:00:00 2001 From: Igor Zinkovsky Date: Wed, 17 Apr 2024 07:19:55 -0700 Subject: perf: v8 code cache (#23081) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR enables V8 code cache for ES modules and for `require` scripts through `op_eval_context`. Code cache artifacts are transparently stored and fetched using sqlite db and are passed to V8. `--no-code-cache` can be used to disable. --------- Co-authored-by: Bartek IwaƄczuk --- cli/worker.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/worker.rs') diff --git a/cli/worker.rs b/cli/worker.rs index 070671e60..7dbb9b177 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -22,6 +22,7 @@ use deno_core::PollEventLoopOptions; use deno_core::SharedArrayBufferStore; use deno_core::SourceMapGetter; use deno_lockfile::Lockfile; +use deno_runtime::code_cache; use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel; use deno_runtime::deno_fs; use deno_runtime::deno_node; @@ -140,6 +141,7 @@ struct SharedWorkerState { enable_future_features: bool, disable_deprecated_api_warning: bool, verbose_deprecated_api_warning: bool, + code_cache: Option>, } impl SharedWorkerState { @@ -411,6 +413,7 @@ impl CliMainWorkerFactory { enable_future_features: bool, disable_deprecated_api_warning: bool, verbose_deprecated_api_warning: bool, + code_cache: Option>, ) -> Self { Self { shared: Arc::new(SharedWorkerState { @@ -434,6 +437,7 @@ impl CliMainWorkerFactory { enable_future_features, disable_deprecated_api_warning, verbose_deprecated_api_warning, + code_cache, }), } } @@ -628,6 +632,7 @@ impl CliMainWorkerFactory { stdio, feature_checker, skip_op_registration: shared.options.skip_op_registration, + v8_code_cache: shared.code_cache.clone(), }; let mut worker = MainWorker::bootstrap_from_options( -- cgit v1.2.3