1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/ext/http
Matt Mastracci 23ff0e722e
feat(ext/web): resourceForReadableStream (#20180)
Extracted from fast streams work.

This is a resource wrapper for `ReadableStream`, allowing us to treat
all `ReadableStream` instances as resources, and remove special paths in
both `fetch` and `serve`.

Performance with a ReadableStream response yields ~18% improvement:

```
  return new Response(new ReadableStream({
    start(controller) {
      controller.enqueue(new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]));
      controller.close();
    }
  })
```

This patch:

```
12:36 $ third_party/prebuilt/mac/wrk http://localhost:8080
Running 10s test @ http://localhost:8080
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    99.96us  100.03us   6.65ms   98.84%
    Req/Sec    47.73k     2.43k   51.02k    89.11%
  959308 requests in 10.10s, 117.10MB read
Requests/sec:  94978.71
Transfer/sec:     11.59MB
```

main:

```
Running 10s test @ http://localhost:8080
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   163.03us  685.51us  19.73ms   99.27%
    Req/Sec    39.50k     3.98k   66.11k    95.52%
  789582 requests in 10.10s, 82.83MB read
Requests/sec:  78182.65
Transfer/sec:      8.20MB
```
2023-08-17 07:52:37 -06:00
..
benches chore: use rustfmt imports_granularity option (#17421) 2023-01-14 23:18:58 -05:00
00_serve.js feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
01_http.js chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
Cargo.toml chore: forward v1.36.1 to main (#20119) 2023-08-10 16:44:41 +03:00
compressible.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
http_next.rs feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
hyper_util_tokioio.rs feat(ext/http): Upgrade to hyper1.0-rc4 (#19987) 2023-07-31 07:34:53 -06:00
lib.rs feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
network_buffered_stream.rs chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
reader_stream.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
README.md chore: add README to ext/http/ (#11958) 2021-09-08 20:48:28 +02:00
request_body.rs feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619) 2023-04-22 11:48:21 -06:00
request_properties.rs refactor(ext/http): generic abstract listeners (#19132) 2023-05-15 16:55:47 +02:00
response_body.rs feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
slab.rs refactor(ext/http): Use const thread-local initializer for slightly better perf (#19881) 2023-07-20 07:30:17 -06:00
websocket_upgrade.rs chore: update to Rust 1.71 (#19822) 2023-07-13 15:16:24 -06:00

deno_http

This crate implements server-side HTTP based on primitives from the Fetch API.