1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 04:48:52 -05:00

perf(ext/headers): use .push loop instead of spread operator (#20108)

This commit is contained in:
Marcos Casagrande 2023-08-10 01:36:47 +02:00 committed by GitHub
parent 08109b1d86
commit 414274b68a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,6 @@ const {
ObjectEntries, ObjectEntries,
ObjectHasOwn, ObjectHasOwn,
RegExpPrototypeExec, RegExpPrototypeExec,
SafeArrayIterator,
SafeMap, SafeMap,
MapPrototypeGet, MapPrototypeGet,
MapPrototypeHas, 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( return ArrayPrototypeSort(
[ entries,
...new SafeArrayIterator(ObjectEntries(headers)),
...new SafeArrayIterator(cookies),
],
(a, b) => { (a, b) => {
const akey = a[0]; const akey = a[0];
const bkey = b[0]; const bkey = b[0];