diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2023-09-16 23:15:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 15:15:15 -0600 |
commit | 16b7c9cd8d0b23ea51ad0070c7589ebefb3d51fa (patch) | |
tree | 840e66f9ddf3208d45f3b132d273e84cc76b2aa7 /README.md | |
parent | d13e6e6db8b3d3f1b8a4e86492e406c3c42d2a9d (diff) |
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
```
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions