mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
An object literal with computed symbol keys is rebuilt through the runtime every time it is evaluated, close to a microsecond each. pipeTo, tee and the byte tee materialized their internal read request as such a literal once per pipe or tee, and the byte tee's BYOB path did so on every read. The requests are now instances of one small class holding the three step functions. A source without pull() ran the pull bookkeeping anyway: two reaction closures and a microtask per read whose only effect was to clear the pulling flag. Push-style sources now skip it. The default tee's pull algorithm was an async function and the byte tee's returned a fresh resolved promise; both now return nothing, which reaches the controller's pull-fulfilled step at the same microtask position without the promise. ReadableStreamBYOBReader.prototype.read() was an async method, so the read request's promise was adopted through a wrapper (an extra promise and two microtask hops per read). It now returns the request's promise directly, as the spec does; argument errors still become rejections. A TransformStream without start() no longer allocates the start promise record: the sides adopt a promise that is already resolved either way. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/66154 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com>