Skip to content
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

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

ronag
Copy link
Member

@ronag ronag commented Oct 2, 2023

streams/writable-manywrites.js len=1024 callback='no' writev='no' sync='no' n=100000              *      7.48 %       ±6.60%  ±8.78% ±11.43%
streams/writable-manywrites.js len=1024 callback='no' writev='no' sync='yes' n=100000           ***      8.19 %       ±3.39%  ±4.51%  ±5.87%
streams/writable-manywrites.js len=1024 callback='no' writev='yes' sync='no' n=100000                   -1.00 %       ±3.29%  ±4.43%  ±5.86%
streams/writable-manywrites.js len=1024 callback='no' writev='yes' sync='yes' n=100000          ***     12.17 %       ±2.83%  ±3.76%  ±4.90%
streams/writable-manywrites.js len=1024 callback='yes' writev='no' sync='no' n=100000             *      3.61 %       ±3.15%  ±4.24%  ±5.60%
streams/writable-manywrites.js len=1024 callback='yes' writev='no' sync='yes' n=100000          ***     13.57 %       ±4.37%  ±5.87%  ±7.77%
streams/writable-manywrites.js len=1024 callback='yes' writev='yes' sync='no' n=100000                   1.32 %       ±7.77% ±10.34% ±13.45%
streams/writable-manywrites.js len=1024 callback='yes' writev='yes' sync='yes' n=100000         ***     21.97 %       ±6.29%  ±8.38% ±10.93%
streams/writable-manywrites.js len=32768 callback='no' writev='no' sync='no' n=100000                    4.20 %       ±7.15%  ±9.53% ±12.43%
streams/writable-manywrites.js len=32768 callback='no' writev='no' sync='yes' n=100000                   4.54 %       ±5.10%  ±6.87%  ±9.11%
streams/writable-manywrites.js len=32768 callback='no' writev='yes' sync='no' n=100000          ***      5.74 %       ±2.37%  ±3.15%  ±4.11%
streams/writable-manywrites.js len=32768 callback='no' writev='yes' sync='yes' n=100000         ***      9.26 %       ±4.66%  ±6.22%  ±8.11%
streams/writable-manywrites.js len=32768 callback='yes' writev='no' sync='no' n=100000            *      4.16 %       ±3.80%  ±5.10%  ±6.72%
streams/writable-manywrites.js len=32768 callback='yes' writev='no' sync='yes' n=100000         ***     11.19 %       ±4.06%  ±5.44%  ±7.16%
streams/writable-manywrites.js len=32768 callback='yes' writev='yes' sync='no' n=100000           *      4.35 %       ±4.12%  ±5.52%  ±7.28%
streams/writable-manywrites.js len=32768 callback='yes' writev='yes' sync='yes' n=100000          *      5.89 %       ±4.74%  ±6.35%  ±8.35%

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Oct 2, 2023
@ronag ronag force-pushed the lazy-buffer branch 3 times, most recently from 91605c3 to fe4064a Compare October 2, 2023 12:09
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 Oct 2, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 2, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@benjamingr benjamingr left a 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

ronag added a commit to nxtedition/node that referenced this pull request Oct 3, 2023
@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@nodejs-github-bot
Copy link
Collaborator

lib/internal/http2/core.js Outdated Show resolved Hide resolved
@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@nodejs-github-bot
Copy link
Collaborator

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

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/.ncu
https://github.com/nodejs/node/actions/runs/6405634162

ronag added a commit to nxtedition/node that referenced this pull request Oct 4, 2023
@ronag ronag added request-ci Add this label to start a Jenkins CI on a PR. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Oct 4, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 4, 2023
@nodejs-github-bot
Copy link
Collaborator

@ronag ronag added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 4, 2023
@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 Oct 4, 2023
@nodejs-github-bot
Copy link
Collaborator

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/.ncu
https://github.com/nodejs/node/actions/runs/6409353418

Comment on lines +537 to +542
if ((state.state & kBuffered) === 0) {
state.state |= kBuffered;
state[kBufferedValue] = [];
}

state[kBufferedValue].push({ chunk, encoding, callback });
Copy link
Contributor

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?

@ronag ronag removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Oct 5, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

RSLGTM

@ronag ronag added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 5, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 5, 2023
@nodejs-github-bot nodejs-github-bot merged commit e9bda11 into nodejs:main Oct 5, 2023
33 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in e9bda11

alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#50013
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit that referenced this pull request Nov 11, 2023
PR-URL: #50013
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
debadree25 pushed a commit to debadree25/node that referenced this pull request Apr 15, 2024
PR-URL: nodejs#50013
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants