1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00
denoland-deno/ext/web
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 refactor: update core extension api usage (#19952) 2023-07-31 18:19:15 +00:00
00_infra.js fix(core): Use safe primordials wrappers (#18687) 2023-04-14 22:23:28 +02:00
01_dom_exception.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
01_mimesniff.js perf: optimize RegExp usage in JS (#19364) 2023-06-05 10:52:40 +02:00
02_event.js perf(ext/event): optimize Event constructor (#20181) 2023-08-17 10:35:18 +02:00
02_structured_clone.js fix(core): Use safe primordials wrappers (#18687) 2023-04-14 22:23:28 +02:00
02_timers.js fix(ext/timers): some timers are not resolved (#20055) 2023-08-10 04:01:35 +00:00
03_abort_signal.js fix(ext/abort): trigger AbortSignal events in correct order (#20095) 2023-08-08 12:05:42 +02:00
04_global_interfaces.js refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041) 2023-03-08 12:44:54 +01:00
05_base64.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
06_streams.js feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
06_streams_types.d.ts chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
08_text_encoding.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
09_file.js fix(ext/file): resolve unresolved Promise in Blob.stream (#20039) 2023-08-04 13:57:54 +02:00
10_filereader.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
12_location.js chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
13_message_port.js fix: call setIsTrusted for generated events (MessageEvent) (#19919) 2023-07-31 23:22:07 +02:00
14_compression.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
15_performance.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
blob.rs Reland "fix(cli): don't store blob and data urls in the module cache" (#18581) 2023-07-02 00:52:30 +02:00
Cargo.toml feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
compression.rs fix(ext/compression): throw TypeError on corrupt input (#19979) 2023-07-30 09:15:29 -04:00
hr_timer_lock.rs chore: update to Rust 1.71 (#19822) 2023-07-13 15:16:24 -06:00
internal.d.ts refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041) 2023-03-08 12:44:54 +01:00
lib.deno_web.d.ts fix(dts): make globals available on globalThis (#19438) 2023-07-03 14:36:55 -04:00
lib.rs feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
message_port.rs chore: use rustfmt imports_granularity option (#17421) 2023-01-14 23:18:58 -05:00
README.md Rename extensions/ directory to ext/ (#11643) 2021-08-11 12:27:05 +02:00
stream_resource.rs feat(ext/web): resourceForReadableStream (#20180) 2023-08-17 07:52:37 -06:00
timers.rs chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00

deno web

Op crate that implements Event, TextEncoder, TextDecoder and File API (https://w3c.github.io/FileAPI).

Testing for text encoding is done via WPT in cli/.