0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00
denoland-deno/ext
Marcos Casagrande 0f1365a574 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]
})
```
2023-08-21 17:00:44 +05:30
..
broadcast_channel 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
cache refactor(ext/cache): Remove custom shutdown and use fast async ops (#20107) 2023-08-09 17:45:35 +00:00
console 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
crypto 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
fetch perf(ext/headers): optimize headers iterable (#20155) 2023-08-21 17:00:44 +05:30
ffi 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
fs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00
http perf(http): use Cow<[u8]> for setting header (#20112) 2023-08-21 17:00:44 +05:30
io chore: deno_core -> 0.201.0 (#20135) 2023-08-21 17:00:44 +05:30
kv 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
napi 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
net 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
node perf(ext/node): cache IncomingMessageForServer.headers (#20147) 2023-08-21 17:00:44 +05:30
tls 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
url 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
web fix(ext/timers): some timers are not resolved (#20055) 2023-08-10 04:01:35 +00:00
webidl 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00
websocket chore: upgrade fastwebsockets to 0.4.4 (#19089) 2023-08-10 09:59:06 +05:30
webstorage 1.36.0 (#20036) 2023-08-03 18:26:25 +02:00