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/web/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/web/lib.rs') diff --git a/ext/web/lib.rs b/ext/web/lib.rs index f3a22d623..b0dc0d56d 100644 --- a/ext/web/lib.rs +++ b/ext/web/lib.rs @@ -109,13 +109,13 @@ deno_core::extension!(deno_web, "14_compression.js", "15_performance.js", ], - config = { + options = { blob_store: BlobStore, maybe_location: Option, }, - state = |state, blob_store, maybe_location| { - state.put(blob_store); - if let Some(location) = maybe_location { + state = |state, options| { + state.put(options.blob_store); + if let Some(location) = options.maybe_location { state.put(Location(location)); } state.put(StartTime::now()); -- cgit v1.2.3