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/webstorage/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/webstorage') diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs index 6cdc7bbff..10be072e8 100644 --- a/ext/webstorage/lib.rs +++ b/ext/webstorage/lib.rs @@ -31,11 +31,11 @@ deno_core::extension!(deno_webstorage, op_webstorage_iterate_keys, ], esm = [ "01_webstorage.js" ], - config = { + options = { origin_storage_dir: Option }, - state = |state, origin_storage_dir| { - if let Some(origin_storage_dir) = origin_storage_dir { + state = |state, options| { + if let Some(origin_storage_dir) = options.origin_storage_dir { state.put(OriginStorageDir(origin_storage_dir)); } }, -- cgit v1.2.3