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` --- ext/flash/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/flash/lib.rs') diff --git a/ext/flash/lib.rs b/ext/flash/lib.rs index 6f11e14af..b6a586d1f 100644 --- a/ext/flash/lib.rs +++ b/ext/flash/lib.rs @@ -1559,11 +1559,11 @@ deno_core::extension!(deno_flash, op_try_flash_respond_chunked, ], esm = [ "01_http.js" ], - config = { + options = { unstable: bool, }, - state = |state, unstable| { - state.put(Unstable(unstable)); + state = |state, options| { + state.put(Unstable(options.unstable)); state.put(FlashContext { next_server_id: 0, join_handles: HashMap::default(), -- cgit v1.2.3