stream: remove Array.p.shift primordial from hotpath of RS.read()

Refs: https://github.com/nodejs/performance/issues/82
This commit is contained in:
Debadree Chatterjee 2023-10-23 19:55:50 +05:30
parent 04f9385311
commit a836b44efc
1 changed files with 2 additions and 2 deletions

View File

@ -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
@ -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