deno/ext
Marcos Casagrande 16b7c9cd8d
perf(ext/http): optimize set_response for small responses (#20527)
This PR introduces an optimization to `set_response` to reduce the
overhead for responses with a payload size less than 64 bytes.
Performance gains are more noticeable when `is_request_compressible`
enters the slow path, ie: `-H 'Accept-Encoding: unknown'`

### Benchmarks
```js
Deno.serve({ port: 3000 }, () => new Response("hello"));
```
```
wrk -d 10s --latency -H 'Accept-Encoding: slow' http://127.0.0.1:3000
```
---
**main**
```
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    44.72us   28.12us   3.10ms   97.95%
    Req/Sec   112.73k     8.25k  123.66k    91.09%
  2264092 requests in 10.10s, 308.77MB read
Requests/sec: 224187.08
Transfer/sec:     30.57MB
```
**this PR**
```
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    42.91us   20.57us   2.04ms   97.36%
    Req/Sec   116.61k     7.95k  204.81k    88.56%
  2330970 requests in 10.10s, 317.89MB read
Requests/sec: 230806.32
Transfer/sec:     31.48MB
```
2023-09-16 15:15:15 -06:00
..
broadcast_channel perf: improve async op santizer speed and accuracy (#20501) 2023-09-16 07:48:31 +02:00
cache feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
console chore: forward v1.36.4 to main (#20352) 2023-09-01 18:08:58 +00:00
crypto refactor: rewrite ext/crypto to op2 (#20477) 2023-09-13 17:54:19 +02:00
fetch perf: improve async op santizer speed and accuracy (#20501) 2023-09-16 07:48:31 +02:00
ffi chore: forward v1.36.4 to main (#20352) 2023-09-01 18:08:58 +00:00
fs chore: bump deno_core and cargo update (#20480) 2023-09-13 22:01:31 +00:00
http perf(ext/http): optimize set_response for small responses (#20527) 2023-09-16 15:15:15 -06:00
io refactor: use TaskQueue from deno_unsync (#20485) 2023-09-13 23:36:24 -04:00
kv refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
napi chore: forward v1.36.4 to main (#20352) 2023-09-01 18:08:58 +00:00
net chore: bump deno_core and cargo update (#20480) 2023-09-13 22:01:31 +00:00
node feat: Add "deno jupyter" subcommand (#20337) 2023-09-16 02:42:09 +02:00
tls chore: forward v1.36.4 to main (#20352) 2023-09-01 18:08:58 +00:00
url chore: forward v1.36.4 to main (#20352) 2023-09-01 18:08:58 +00:00
web refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
webidl feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
websocket chore: bump deno_core and cargo update (#20480) 2023-09-13 22:01:31 +00:00
webstorage refactor: rewrite ext/io, ext/webstorage ops to op2 (#20461) 2023-09-12 12:42:05 +02:00