stream: use the ring buffer for pending BYOB pull-into descriptors · nodejs/node@8aba475 · GitHub
Skip to content

Commit 8aba475

Browse files
mcollinaaduh95
authored andcommitted
stream: use the ring buffer for pending BYOB pull-into descriptors
The byte controller's [[pendingPullIntos]] list was still a plain array consumed with ArrayPrototypeShift, while every other per-chunk queue in the WHATWG streams implementation has moved to the Queue ring buffer. BYOB reads push and shift one descriptor per read, and Array.prototype shift has real per-call cost even at length 1. Back the descriptor list with the same lazily materialized Queue used for the request queues, so constructing a byte stream still allocates no descriptor storage. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #64818 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent d80a45f commit 8aba475

3 files changed

Lines changed: 164 additions & 86 deletions

File tree

benchmark/webstreams/tee.js

Lines changed: 44 additions & 0 deletions

0 commit comments

Comments
 (0)