mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
4960b6659c
This PR optimizes `ReadableStream` async iterator ### Benchmarks ```js Deno.bench("Stream - iterator", async () => { const stream = new ReadableStream({ start(controller) { controller.enqueue(new Uint8Array([97])); controller.enqueue(new Uint8Array([97])); controller.close(); }, }); for await (const chunk of stream) {} }); ``` **main** `2 chunks` ``` cpu: 13th Gen Intel(R) Core(TM) i9-13900H runtime: deno 1.36.4 (x86_64-unknown-linux-gnu) benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------- ----------------------------- Stream - iterator 12.45 µs/iter 80,295.5 (10.5 µs … 281.12 µs) 12.13 µs 26.71 µs 33.63 µs ``` `20 chunks` ``` benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------- ----------------------------- Stream - iterator 32.99 µs/iter 30,312.2 (28.13 µs … 1.21 ms) 31.8 µs 81.82 µs 179.93 µs ``` --- **this PR** `2 chunks` ``` cpu: 13th Gen Intel(R) Core(TM) i9-13900H runtime: deno 1.36.4 (x86_64-unknown-linux-gnu) benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------- ----------------------------- Stream - iterator 9.37 µs/iter 106,700.8 (8.35 µs … 730.71 µs) 9.15 µs 13.12 µs 18.17 µs ``` `20 chunks` ``` benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------- ----------------------------- Stream - iterator 16.59 µs/iter 60,270.0 (12.08 µs … 1.37 ms) 15.06 µs 83.03 µs 123.52 µs ``` |
||
---|---|---|
.. | ||
benches | ||
00_infra.js | ||
01_dom_exception.js | ||
01_mimesniff.js | ||
02_event.js | ||
02_structured_clone.js | ||
02_timers.js | ||
03_abort_signal.js | ||
04_global_interfaces.js | ||
05_base64.js | ||
06_streams.js | ||
06_streams_types.d.ts | ||
08_text_encoding.js | ||
09_file.js | ||
10_filereader.js | ||
12_location.js | ||
13_message_port.js | ||
14_compression.js | ||
15_performance.js | ||
blob.rs | ||
Cargo.toml | ||
compression.rs | ||
hr_timer_lock.rs | ||
internal.d.ts | ||
lib.deno_web.d.ts | ||
lib.rs | ||
message_port.rs | ||
README.md | ||
stream_resource.rs | ||
timers.rs |
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/.