perf research: streams#4
Draft
crowlbot wants to merge 2 commits into
Draft
Conversation
Microbench covers ReadableStream construct/read, TransformStream identity + copy pipeThrough, WritableStream pipeTo sink, BYOB read, async iter, and tee. Benches were not run before the session was transferred — the next worker should run the micro across deno/node/bun, capture a V8 prof, and write up the report per the pattern used in perf-research/fetch (PR 1), perf-research/url (PR 2), and perf-research/text-encoding (PR 3) on the crowlbot/deno fork.
16 MB pipeThrough macro: Deno 440.7 MB/s vs Bun 296.8 / Node 22.13 221.3 / Node 23.7 243.2. Microbench: Deno is faster than Node on every bench that completed, within 1.5x of Bun on construction microbenches and ahead of both Node and Bun on pipeThrough/pipeTo. V8 prof on the macro bench attributes ~50 percent of ticks to user transform code (per-byte loop + new Uint8Array(N)), ~24 percent to shared libraries (libc malloc / deno binary, mostly the same allocation tail), and only ~5 percent of nonlib ticks to streams machinery itself. No high-impact streams architectural slowdown to attack.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
No high-impact architectural slowdown found in the streams machinery. Across the macro and microbench, Deno's
ReadableStream/WritableStream/TransformStreameither beat Node 22 LTS / Node 23 / Bun, or are within ~1.5× on small-construction microbenches.This PR exists to record the negative result so a future session does not re-investigate.
Headline ratios
16 MB body through
pipeThrough(TransformStream uppercase) → pipeTo(sink), 20 itersMicrobench excerpts (ns/op, lower is better)
ts_constructrs_read_256x4krs_pipethrough_identity_256x4krs_pipeto_sink_256x4kFull results are in
tools/perf_research/streams/profiles/streams_*.json. Seetools/perf_research/streams/README.mdfor the full report (hypotheses considered and ruled out, V8 prof attribution).Where the time goes
V8 prof on the macro bench (
tools/perf_research/streams/profiles/streams_macro.prof.txt):transformfunction (per-byte uppercase loop +new Uint8Array(N)).writeAlgorithm,chunkSteps,transformAlgorithm).The user-allocation tail (
new Uint8Array(N)hitting libc malloc) is the same cross-cutting cost already documented in PR #1 (fetch, H3) and PR #3 (text-encoding, H1). Root cause isv8_typed_array_max_size_in_heap = 0in rusty-v8 — out of streams scope.Hypotheses considered and ruled out
What's not here
kernel.perf_event_paranoid = 4on the bench host andsudois unavailable, soperf/samplyare blocked. JS attribution via V8--profis what's inprofiles/streams_macro.prof.txt. This same constraint applied to PRs perf research: fetch #1–perf research: text-encoding #3 on this fork.Layout