mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
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`
This commit is contained in:
parent
e55b448730
commit
3487fde236
27 changed files with 206 additions and 174 deletions
|
@ -2834,13 +2834,13 @@ deno_core::extension!(deno_tsc,
|
|||
op_script_names,
|
||||
op_script_version,
|
||||
],
|
||||
config = {
|
||||
options = {
|
||||
performance: Arc<Performance>
|
||||
},
|
||||
state = |state, performance| {
|
||||
state = |state, options| {
|
||||
state.put(State::new(
|
||||
Arc::new(StateSnapshot::default()),
|
||||
performance,
|
||||
options.performance,
|
||||
));
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue