Skip to content

stream: lazy allocate back pressure buffer - #50013

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
nxtedition:lazy-buffer
Oct 5, 2023
Merged

stream: lazy allocate back pressure buffer#50013
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
nxtedition:lazy-buffer

Conversation

@ronag

@ronagronag commented Oct 2, 2023

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

Review requested:

  • @nodejs/streams

@nodejs-github-botnodejs-github-bot added the needs-ci PRs that need a full CI run. label Oct 2, 2023
@ronag
ronagforce-pushed the lazy-buffer branch 3 times, most recently from 91605c3 to fe4064aCompareOctober 2, 2023 12:09
Comment threadlib/internal/streams/writable.js Outdated

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

lgtm

@ronagronag added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 2, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 2, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/streams/writable.js Outdated

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

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

@ronagronag added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/http2/core.js Outdated
Comment threadlib/internal/streams/writable.js Outdated
@ronagronag added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronagronag added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@nodejs-github-bot

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

@ronagronag 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-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 4, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

@ronagronag 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
Copy Markdown
Collaborator

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

RSLGTM

@ronagronag added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 5, 2023
@nodejs-github-botnodejs-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:mainOct 5, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in e9bda11

targos pushed a commit that referenced this pull request Nov 11, 2023
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>
@targostargos mentioned this pull request Nov 12, 2023
debadree25 pushed a commit to debadree25/node that referenced this pull request Apr 15, 2024
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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ronag@nodejs-github-bot@mcollina@benjamingr@lpinca@MoLow@liuxingbaoyu