mirror of
https://github.com/denoland/deno.git
synced 2024-10-29 08:58:01 -04:00
perf(fetch): optimize fillHeaders() key iteration (#12287)
Reduces self-time by ~70x (~70ms => ~1ms on 1M iters) for...in filtered by hasOwnProperty yields the same set of keys as Object.keys()
This commit is contained in:
parent
5065c7bcd9
commit
f68825eda0
1 changed files with 5 additions and 2 deletions
|
@ -29,7 +29,7 @@
|
|||
ArrayPrototypeJoin,
|
||||
ArrayPrototypeSplice,
|
||||
ArrayPrototypeFilter,
|
||||
ObjectKeys,
|
||||
ObjectPrototypeHasOwnProperty,
|
||||
ObjectEntries,
|
||||
RegExpPrototypeTest,
|
||||
Symbol,
|
||||
|
@ -76,7 +76,10 @@
|
|||
appendHeader(headers, header[0], header[1]);
|
||||
}
|
||||
} else {
|
||||
for (const key of ObjectKeys(object)) {
|
||||
for (const key in object) {
|
||||
if (!ObjectPrototypeHasOwnProperty(object, key)) {
|
||||
continue;
|
||||
}
|
||||
appendHeader(headers, key, object[key]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue