FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

stream: readable read one buffer at a time by ronag · Pull Request #60441 · nodejs/node · GitHub

/ node Public

stream: readable read one buffer at a time - #60441

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
ronag:read-no-copy
Jan 21, 2026
Merged

stream: readable read one buffer at a time#60441
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
ronag:read-no-copy

Conversation

ronag commented Oct 27, 2025
edited
Loading

Copy link
Copy Markdown
Member
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 requested a review from mcollina October 27, 2025 18:44

nodejs-github-bot commented Oct 27, 2025
edited by ronag
Loading

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

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

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

code lgtm

I think some docs changes are needed

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

mcollina commented Jan 2, 2026

Copy link
Copy Markdown
Member

Marked as semver-major.

lpinca commented Jan 2, 2026
edited
Loading

Copy link
Copy Markdown
Member

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 commented Jan 2, 2026
edited
Loading

Copy link
Copy Markdown
Member Author

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 commented Jan 2, 2026

Copy link
Copy Markdown
Member Author

I think some docs changes are needed

What doc changes are you roughly asking for?

ronag force-pushed the read-no-copy branch 2 times, most recently from a380c35 to 0798db8 Compare January 2, 2026 08:55
ronag marked this pull request as ready for review January 2, 2026 08:56
ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 2, 2026
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 Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor
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 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 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

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2026
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2026

Copy link
Copy Markdown
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 commented Jan 5, 2026

Copy link
Copy Markdown
Member Author

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

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

Copy link
Copy Markdown
Collaborator

lpinca commented Jan 5, 2026

Copy link
Copy Markdown
Member

@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 commented Jan 5, 2026

Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Collaborator

ronag added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jan 6, 2026

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

ronag requested review from jasnell and lpinca January 6, 2026 18:34

gurgunday left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 20, 2026
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

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Member

@nodejs/tsc can I get another approval?

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

Copy link
Copy Markdown
Collaborator

Landed in fadb214

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 outstanding review comments, 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


Back | FazBrowse Home | New Git URL