Skip to content

Conversation

@ronag
Copy link
Member

@ronag ronag commented Oct 27, 2025

Instead of wasting cycles concatenating buffers, just return each
one by one.

Similar (but not exact) old behavior can be achieved by using
`readable.read(readable.readableLength)` instead of
`readable.read()`. In some edge cases it might be necessary
to do a `readable.read(0)` first.

@ronag ronag requested a review from mcollina October 27, 2025 18:44
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Oct 27, 2025

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Oct 27, 2025
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

I think some docs changes are needed

@mcollina mcollina added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jan 2, 2026
@mcollina
Copy link
Member

mcollina commented Jan 2, 2026

Marked as semver-major.

@lpinca
Copy link
Member

lpinca commented Jan 2, 2026

I'm -1 on this unless there is a strong reason for it. Historically, readable.read() has always returned all queued data. If this lands, I think that the easiest workaround for modules affected by the breaking change would be replacing readable.read() with readable.read(readable.readableLength).

@ronag
Copy link
Member Author

ronag commented Jan 2, 2026

I'm -1 on this unless there is a strong reason for it.

The performance overhead is huge. As it stand we should at least add a note to avoid this api for anything performance sensitive.

If this lands, I think that the easiest workaround for modules affected by the breaking change would be replacing readable.read() with readable.read(readable.readableLength).

Good point.

@ronag
Copy link
Member Author

ronag commented Jan 2, 2026

I think some docs changes are needed

What doc changes are you roughly asking for?

@ronag ronag force-pushed the read-no-copy branch 2 times, most recently from a380c35 to 0798db8 Compare January 2, 2026 08:55
ronag added a commit to ronag/node that referenced this pull request Jan 2, 2026
Instead of wasting cycles concatenating buffers, just return each
one by one.

Old behavior can be achieved by using `readable.read(readable.readableLength)` instead of `readable.read()`.

PR: nodejs#60441
@ronag ronag marked this pull request as ready for review January 2, 2026 08:56
@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 2, 2026
ronag added a commit to ronag/node that referenced this pull request Jan 2, 2026
Instead of wasting cycles concatenating buffers, just return each
one by one.

Old behavior can be achieved by using `readable.read(readable.readableLength)` instead of `readable.read()`.

PR: nodejs#60441
ronag added a commit to ronag/node that referenced this pull request Jan 2, 2026
Instead of wasting cycles concatenating buffers, just return each
one by one.

Old behavior can be achieved by using `readable.read(readable.readableLength)` instead of `readable.read()`.

PR: nodejs#60441
ronag added a commit to ronag/node that referenced this pull request Jan 2, 2026
Instead of wasting cycles concatenating buffers, just return each
one by one.

Old behavior can be achieved by using `readable.read(readable.readableLength)` instead of `readable.read()`.

PR: nodejs#60441
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jan 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2026

Failed to start CI
   ⚠  Commits were pushed since the last approving review:
   ⚠  - stream: readable read one buffer at a time
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/20654449594

@ronag ronag added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. labels Jan 2, 2026
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jan 2, 2026
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2026
@nodejs-github-bot
Copy link
Collaborator

Instead of wasting cycles concatenating buffers, just return each
one by one.

Similar (but not exact) old behavior can be achieved by using
`readable.read(readable.readableLength)` instead of
`readable.read()`. In some edge cases it might be necessary
to do a `readable.read(0)` first.

PR: nodejs#60441
@ronag
Copy link
Member Author

ronag commented Jan 5, 2026

@lpinca Do you need help fixing ws in relation to this PR or can you deal with it yourself?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nodejs-github-bot
Copy link
Collaborator

@lpinca
Copy link
Member

lpinca commented Jan 5, 2026

@lpinca Do you need help fixing ws in relation to this PR or can you deal with it yourself?

I've already fixed it in websockets/ws@1998485

@ronag
Copy link
Member Author

ronag commented Jan 5, 2026

@nodejs-github-bot
Copy link
Collaborator

@ronag ronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 6, 2026
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ronag ronag requested review from jasnell and lpinca January 6, 2026 18:34
Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 20, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 20, 2026
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/60441
✔  Done loading data for nodejs/node/pull/60441
----------------------------------- PR info ------------------------------------
Title      stream: readable read one buffer at a time (#60441)
Author     Robert Nagy <ronagy@icloud.com> (@ronag)
Branch     ronag:read-no-copy -> nodejs:main
Labels     stream, semver-major, author ready, needs-ci, needs-citgm
Commits    1
 - stream: readable read one buffer at a time
Committers 1
 - Robert Nagy <ronagy@icloud.com>
PR-URL: https://github.com/nodejs/node/pull/60441
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/60441
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Mon, 27 Oct 2025 18:44:50 GMT
   ✔  Approvals: 3
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/60441#pullrequestreview-3631894479
   ✔  - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/60441#pullrequestreview-3632251382
   ✔  - Gürgün Dayıoğlu (@gurgunday): https://github.com/nodejs/node/pull/60441#pullrequestreview-3635847744
   ✘  semver-major requires at least 2 TSC approvals
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-01-05T21:27:50Z: https://ci.nodejs.org/job/node-test-pull-request/70687/
   ℹ  Last CITGM CI on 2026-01-05T09:54:54Z: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/3663/
- Querying data for job/node-test-pull-request/70687/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/21187285768

@mcollina
Copy link
Member

@nodejs/tsc can I get another approval?

@mcollina mcollina added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jan 21, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 21, 2026
@nodejs-github-bot nodejs-github-bot merged commit fadb214 into nodejs:main Jan 21, 2026
74 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in fadb214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. needs-citgm PRs that need a CITGM CI run. semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants