-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: lazy allocate back pressure buffer #50013
Conversation
ronag
commented
Oct 2, 2023
•
edited
Loading
edited
Review requested:
|
91605c3
to
fe4064a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to deal with cases the consumer calls .buffered.length as we see from http2, so we can probably define a prototype getter for it that returns it if not initialised and internally use a different property name
Commit Queue failed- Loading data for nodejs/node/pull/50013 ✔ Done loading data for nodejs/node/pull/50013 ----------------------------------- PR info ------------------------------------ Title stream: lazy allocate back pressure buffer (#50013) Author Robert Nagy (@ronag) Branch ronag:lazy-buffer -> nodejs:main Labels author ready, needs-ci Commits 3 - stream: lazy allocate back pressure buffer - Update lib/internal/http2/core.js - Update lib/internal/streams/writable.js Committers 2 - Robert Nagy - GitHub PR-URL: https://github.com/nodejs/node/pull/50013 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/50013 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum -------------------------------------------------------------------------------- ℹ This PR was created on Mon, 02 Oct 2023 11:57:50 GMT ✔ Approvals: 2 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/50013#pullrequestreview-1652639906 ✔ - Benjamin Gruenbaum (@benjamingr) (TSC): https://github.com/nodejs/node/pull/50013#pullrequestreview-1654890641 ⚠ This PR has conflicts that must be resolved ✘ Last GitHub CI failed ℹ Last Full PR CI on 2023-10-03T10:34:32Z: https://ci.nodejs.org/job/node-test-pull-request/54490/ - Querying data for job/node-test-pull-request/54490/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/6405634162 |
Commit Queue failed- Loading data for nodejs/node/pull/50013 ✔ Done loading data for nodejs/node/pull/50013 ----------------------------------- PR info ------------------------------------ Title stream: lazy allocate back pressure buffer (#50013) Author Robert Nagy (@ronag) Branch ronag:lazy-buffer -> nodejs:main Labels author ready, needs-ci Commits 1 - stream: lazy allocate back pressure buffer Committers 1 - Robert Nagy PR-URL: https://github.com/nodejs/node/pull/50013 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/50013 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - stream: lazy allocate back pressure buffer ℹ This PR was created on Mon, 02 Oct 2023 11:57:50 GMT ✔ Approvals: 2 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/50013#pullrequestreview-1652639906 ✔ - Benjamin Gruenbaum (@benjamingr) (TSC): https://github.com/nodejs/node/pull/50013#pullrequestreview-1654890641 ✘ Last GitHub CI failed ℹ Last Full PR CI on 2023-10-04T14:36:55Z: https://ci.nodejs.org/job/node-test-pull-request/54529/ - Querying data for job/node-test-pull-request/54529/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/6409353418 |
if ((state.state & kBuffered) === 0) { | ||
state.state |= kBuffered; | ||
state[kBufferedValue] = []; | ||
} | ||
|
||
state[kBufferedValue].push({ chunk, encoding, callback }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((state.state & kBuffered) === 0) {
state.state |= kBuffered;
state[kBufferedValue] = [{ chunk, encoding, callback }];
} else {
state[kBufferedValue].push({ chunk, encoding, callback });
}
Just curious, will there be any observable performance improvements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSLGTM
Landed in e9bda11 |
PR-URL: nodejs#50013 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #50013 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#50013 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>