diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2023-08-14 21:13:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-14 19:13:55 +0000 |
commit | 625bd3905047173390eeaffd0ffcbb0bf340bb52 (patch) | |
tree | 2cdc3ca609d21db39efd0d8526db506ab9d6df32 /ext/web/06_streams.js | |
parent | e071382768fa57b5288a6a5ba90e73bf5870b169 (diff) |
perf(ext/headers): optimize headers iterable (#20155)
This PR makes more optimizations to headers iterable by removing
`ObjectEntries` which was consistently prominent in the flame graph when
benchmarking an express server.
**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)
benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------------------------ -----------------------------
headers iter 9.6 µs/iter 104,134.1 (8.74 µs … 131.31 µs) 9.47 µs 12.61 µs 17.81 µs
```
**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)
benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------------------------ -----------------------------
headers iter 12.87 µs/iter 77,675.9 (11.97 µs … 132.34 µs) 12.76 µs 16.49 µs 26.4 µs
```
```js
const headers = new Headers({
"Content-Type": "application/json",
"X-Content-Type": "application/json",
"Date": "Thu, 14 Aug 2023 17:45:10 GMT",
"X-Deno": "Deno",
"Powered-By": "Deno",
"Content-Encoding": "gzip",
"Set-Cookie": "__Secure-ID=123; Secure; Domain=example.com",
"Content-Length": "150",
"Vary": "Accept-Encoding, Accept, X-Requested-With",
});
Deno.bench('headers iter', () => {
[...headers]
})
```
Diffstat (limited to 'ext/web/06_streams.js')
0 files changed, 0 insertions, 0 deletions