From fec0f1c8bbebd61f2b4cfc497d8034486340db50 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Thu, 30 Sep 2021 21:33:12 +0200 Subject: [PATCH] perf(webidl): optimize createDictionaryConverter() (#12279) On a benchmark constructing Responses with headers this shaves off 25% --- ext/webidl/00_webidl.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index d5bad4f158..08de5aba66 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -41,6 +41,7 @@ NumberMAX_SAFE_INTEGER, // deno-lint-ignore camelcase NumberMIN_SAFE_INTEGER, + ObjectAssign, ObjectCreate, ObjectDefineProperties, ObjectDefineProperty, @@ -726,7 +727,7 @@ } const esDict = V; - const idlDict = { ...defaultValues }; + const idlDict = ObjectAssign({}, defaultValues); // NOTE: fast path Null and Undefined. if ((V === undefined || V === null) && !hasRequiredKey) {