Skip to content

Commit

Permalink
stream: remove Array.p.shift primordial from hotpath of RS.read()
Browse files Browse the repository at this point in the history
  • Loading branch information
debadree25 committed Oct 23, 2023
1 parent 04f9385 commit a836b44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ function readableStreamFulfillReadRequest(stream, chunk, done) {
reader,
} = stream[kState];
assert(reader[kState].readRequests.length);
const readRequest = ArrayPrototypeShift(reader[kState].readRequests);
const readRequest = reader[kState].readRequests.shift();

// TODO(@jasnell): It's not clear under what exact conditions done
// will be true here. The spec requires this check but none of the
Expand All @@ -2102,7 +2102,7 @@ function readableStreamFulfillReadIntoRequest(stream, chunk, done) {
reader,
} = stream[kState];
assert(reader[kState].readIntoRequests.length);
const readIntoRequest = ArrayPrototypeShift(reader[kState].readIntoRequests);
const readIntoRequest = reader[kState].readIntoRequests.shift();
if (done)
readIntoRequest[kClose](chunk);
else
Expand Down

0 comments on commit a836b44

Please sign in to comment.