Files
node/lib
Matteo Collina 4e75b714df stream: trim TransformStream construction costs
Constructing a TransformStream allocated five closures for the sink and
source algorithms of its two sides, and each side adopted the start
promise through a wrapper promise plus a thenable job, so a stream
without a start() left about three kilobytes pending in the microtask
queue until the started steps ran. Per-stream creation bursts spend
most of their time copying that graph through the scavenger.

The sink and source algorithms are now shared functions that reach the
transform stream through a field on their controller state (the
controller is passed to the close, abort and cancel algorithms for
that), and the post-start steps of both sides are delivered by one
reaction chain on a shared promise, taking the same microtask hops as
the spec's start promise adoption: three after construction for a
non-thenable start result, two after the adopting promise settles for a
thenable one. The readable and writable transfer state records are
materialized on first transfer instead of per stream.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/66643
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-10-17 06:20:05 +00:00
..
2026-09-03 15:37:21 +00:00
…
…
…
…
…
…
…
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
…
2026-09-05 02:49:02 +00:00
2026-09-28 04:22:37 +00:00
2026-09-12 11:52:10 +00:00
…
2026-09-03 11:40:52 +02:00
…
2026-10-04 03:56:13 +00:00
…
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
…
2026-10-05 21:26:47 +00:00
…
…
…
…
…
…
…
…
2026-08-23 15:52:12 +00:00
…
2026-09-03 11:48:46 +02:00
2026-10-15 07:53:03 +00:00
…
…