summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-03-17 16:15:27 -0600
committerGitHub <noreply@github.com>2023-03-17 22:15:27 +0000
commit3487fde236d0852a8b0672c293fa41a741f471e8 (patch)
treeaf466368147a08b787080446319a3a46a60ee37d /cli/build.rs
parente55b448730160a6e4df9815a268d4049ac89deab (diff)
perf(core) Reduce copying and cloning in extension initialization (#18252)
Follow-up to #18210: * we are passing the generated `cfg` object into the state function rather than passing individual config fields * reduce cloning dramatically by making the state_fn `FnOnce` * `take` for `ExtensionBuilder` to avoid more unnecessary copies * renamed `config` to `options`
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/cli/build.rs b/cli/build.rs
index e4df856f7..9068723d4 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -1,9 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use std::cell::RefCell;
use std::env;
use std::path::PathBuf;
-use std::rc::Rc;
use deno_core::snapshot_util::*;
use deno_core::Extension;
@@ -122,15 +120,15 @@ mod ts {
"00_typescript.js",
"99_main_compiler.js",
],
- config = {
+ options = {
op_crate_libs: HashMap<&'static str, PathBuf>,
build_libs: Vec<&'static str>,
path_dts: PathBuf,
},
- state = |state, op_crate_libs, build_libs, path_dts| {
- state.put(op_crate_libs);
- state.put(build_libs);
- state.put(path_dts);
+ state = |state, options| {
+ state.put(options.op_crate_libs);
+ state.put(options.build_libs);
+ state.put(options.path_dts);
},
);
@@ -362,7 +360,7 @@ fn create_cli_snapshot(snapshot_path: PathBuf) {
deno_tls::deno_tls::init_ops(),
deno_napi::deno_napi::init_ops::<PermissionsContainer>(),
deno_http::deno_http::init_ops(),
- deno_io::deno_io::init_ops(Rc::new(RefCell::new(Some(Default::default())))),
+ deno_io::deno_io::init_ops(Default::default()),
deno_fs::deno_fs::init_ops::<PermissionsContainer>(false),
deno_flash::deno_flash::init_ops::<PermissionsContainer>(false), // No --unstable
deno_node::deno_node_loading::init_ops::<PermissionsContainer>(None), // No --unstable.