From 414274b68a80199c3fb6bfb3890b0afb79f5b7f9 Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Thu, 10 Aug 2023 01:36:47 +0200 Subject: perf(ext/headers): use .push loop instead of spread operator (#20108) --- ext/fetch/20_headers.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ext/fetch') diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js index bea542c30..45bd29ad3 100644 --- a/ext/fetch/20_headers.js +++ b/ext/fetch/20_headers.js @@ -31,7 +31,6 @@ const { ObjectEntries, ObjectHasOwn, RegExpPrototypeExec, - SafeArrayIterator, SafeMap, MapPrototypeGet, MapPrototypeHas, @@ -262,11 +261,13 @@ class Headers { } } + const entries = ObjectEntries(headers); + for (let i = 0; i < cookies.length; ++i) { + ArrayPrototypePush(entries, cookies[i]); + } + return ArrayPrototypeSort( - [ - ...new SafeArrayIterator(ObjectEntries(headers)), - ...new SafeArrayIterator(cookies), - ], + entries, (a, b) => { const akey = a[0]; const bkey = b[0]; -- cgit v1.2.3