summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-08 07:43:26 -0400
committerGitHub <noreply@github.com>2023-03-08 12:43:26 +0100
commitd24c6ea27f7dea57e3bc0cda342d6cbe59782f7d (patch)
tree469e992cb32b995613679f9aba2fdca6f56d5d3f /cli/build.rs
parent9eb987e46c4d51badc9a566c880798d925d35d54 (diff)
refactor(runtime): conditionally register Extension with source files (#18068)
Since we are snapshotting extension source at build time, there's no need to define list of sources for the extension at runtime. This commit changes "deno_node" extension by removing "init_polyfill" function in favor of "init_polyfill_ops_and_esm()" and "init_polyfill_ops()". The former is used during snapshot and when "deno_runtime" is compiled with "dont_create_runtime_snapshot" cargo feature flag. The latter is used when running a worker from an existing snapshot. This is a start of a bigger refactor to all extensions - thanks to this change, we don't have to iterate over all defined source files for extension at runtime, and because of that we don't have to create a filepath for each of the source files. It's not a big deal, but we are iterating over 300 files on each start, and concatenating 3 strings before creating a "PathBuf" for ~200 of them. This is already visible on the startup flamegraphs and should be avoided.
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 21e702aed..ddcd08778 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -343,7 +343,7 @@ fn create_cli_snapshot(snapshot_path: PathBuf) {
deno_io::init(Default::default()),
deno_fs::init::<PermissionsContainer>(false),
deno_node::init::<PermissionsContainer>(None), // No --unstable.
- deno_node::init_polyfill(),
+ deno_node::init_polyfill_ops_and_esm(),
deno_ffi::init::<PermissionsContainer>(false),
deno_net::init::<PermissionsContainer>(
None, false, // No --unstable.