stream: fold desired-size check into WHATWG backpressure update · nodejs/node@de4ca2c · GitHub
Skip to content

Commit de4ca2c

Browse files
mcollinaaduh95
authored andcommitted
stream: fold desired-size check into WHATWG backpressure update
writableStreamUpdateBackpressure ran two release-mode assertions and took a precomputed backpressure value that every caller derived with a separate GetBackpressure/GetDesiredSize call pair. All callers already hold the 'writable', not-close-queued invariant the assertions checked, so derive the backpressure from the desired size inside the function and drop the assertions and the helper. This runs up to twice per write. writer.write() loop: +10%, pipe-to: +4.6% avg over 16 configs (local harness / benchmark, all configs positive). Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #64451 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 63321ee commit de4ca2c

1 file changed

Lines changed: 12 additions & 21 deletions

File tree

lib/internal/webstreams/writablestream.js

Lines changed: 12 additions & 21 deletions

0 commit comments

Comments
 (0)