From 3487fde236d0852a8b0672c293fa41a741f471e8 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Fri, 17 Mar 2023 16:15:27 -0600 Subject: 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` --- runtime/ops/os/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/ops/os') diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs index 87181654b..b34629395 100644 --- a/runtime/ops/os/mod.rs +++ b/runtime/ops/os/mod.rs @@ -42,11 +42,11 @@ deno_core::ops!( deno_core::extension!( deno_os, ops_fn = deno_ops, - config = { + options = { exit_code: ExitCode, }, - state = |state, exit_code| { - state.put::(exit_code); + state = |state, options| { + state.put::(options.exit_code); }, ); -- cgit v1.2.3