Skip to content

stream: refactor Writable buffering - #31046

Closed
ronag wants to merge 1 commit into
nodejs:masterfrom
nxtedition:stream-writable-buffered2
Closed

stream: refactor Writable buffering#31046
ronag wants to merge 1 commit into
nodejs:masterfrom
nxtedition:stream-writable-buffered2

Conversation

@ronag

@ronagronag commented Dec 20, 2019

Copy link
Copy Markdown
Member

Another try on this, now without the reduced performance:

 streams/writable-manywrites.js callback='no' writev='no' sync='no' n=2000000 *** 8.49 % ±1.42% ±1.88% ±2.42%
streams/writable-manywrites.js callback='no' writev='no' sync='yes' n=2000000 0.28 % ±1.38% ±1.84% ±2.40%
streams/writable-manywrites.js callback='no' writev='yes' sync='no' n=2000000 *** 36.63 % ±3.10% ±4.09% ±5.28%
streams/writable-manywrites.js callback='no' writev='yes' sync='yes' n=2000000 -0.72 % ±2.57% ±3.42% ±4.46%
streams/writable-manywrites.js callback='yes' writev='no' sync='no' n=2000000 *** 6.75 % ±1.16% ±1.54% ±1.99%
streams/writable-manywrites.js callback='yes' writev='no' sync='yes' n=2000000 -0.67 % ±1.86% ±2.48% ±3.23%
streams/writable-manywrites.js callback='yes' writev='yes' sync='no' n=2000000 *** 10.91 % ±1.75% ±2.33% ±3.02%
streams/writable-manywrites.js callback='yes' writev='yes' sync='yes' n=2000000 -1.70 % ±2.71% ±3.61% ±4.70%

Benchmarks from #31066

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Dec 20, 2019
@ronag
ronagforce-pushed the stream-writable-buffered2 branch 4 times, most recently from 24f8b15 to 0c9b7e7CompareDecember 20, 2019 22:20
Comment threadlib/_stream_writable.js Outdated
@mscdex

Copy link
Copy Markdown
Contributor

Might be a good idea to check CITGM to check for dependencies on the old internal state properties?

@ronagronag mentioned this pull request Dec 21, 2019
4 tasks
@ronag
ronagforce-pushed the stream-writable-buffered2 branch from e6c3b63 to 76eb9ecCompareDecember 21, 2019 08:21
@ronag

Copy link
Copy Markdown
MemberAuthor

@mscdex: I noticed that using symbol accessors seems slower than regular properties. Is this something we are aware of or am I just unlucky in my benchmarks?

@ronag

This comment has been minimized.

@ronag
ronagforce-pushed the stream-writable-buffered2 branch 5 times, most recently from bd5e468 to 3df92f4CompareDecember 23, 2019 15:27
Comment threadbenchmark/streams/writable-manywrites.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
@ronag
ronagforce-pushed the stream-writable-buffered2 branch from 5a4a300 to fd9c408CompareDecember 23, 2019 19:45
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
@ronag
ronagforce-pushed the stream-writable-buffered2 branch from a7d1723 to 393c31fCompareDecember 23, 2019 23:20
@nodejs-github-bot

nodejs-github-bot commented Dec 25, 2019

Copy link
Copy Markdown
Collaborator

@ronag
ronagforce-pushed the stream-writable-buffered2 branch from 709439b to 393c31fCompareDecember 25, 2019 10:28
@ronag
ronagforce-pushed the stream-writable-buffered2 branch from 393c31f to 8165483CompareJanuary 1, 2020 12:04
@ronag

ronag commented Jan 1, 2020

Copy link
Copy Markdown
MemberAuthor

rebased to fix conflicts

@ronag
ronagforce-pushed the stream-writable-buffered2 branch 3 times, most recently from 5b9a81c to b161293CompareJanuary 1, 2020 14:23

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

This looks very promising!

Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated

@BridgeARBridgeAR 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 with a green CITGM.

Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js
@ronagronag removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 22, 2020
Comment threadlib/_stream_writable.js
@mafintosh

Copy link
Copy Markdown
Member

LGTM on green canary

@ronagronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 23, 2020
@ronag

Copy link
Copy Markdown
MemberAuthor

@ronag

Copy link
Copy Markdown
MemberAuthor

CITGM OK. ws failure is expected and not related to this PR.

@ronag

This comment has been minimized.

ronag added a commit that referenced this pull request Apr 23, 2020
Refactors buffering in Writable to use an array
instead of a linked list.
PR-URL: #31046
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@ronag

Copy link
Copy Markdown
MemberAuthor

Landed in d8c57cb

@ronagronag closed this Apr 23, 2020
@mscdex

mscdex commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

There seems to have been some significant performance regressions with the latest changes:

 confidence improvement accuracy (*) (**) (***)
streams/creation.js kind='duplex' n=50000000 * 2.44 % ±1.87% ±2.49% ±3.25%
streams/creation.js kind='readable' n=50000000 0.57 % ±3.10% ±4.12% ±5.36%
streams/creation.js kind='transform' n=50000000 * 3.44 % ±2.81% ±3.73% ±4.86%
streams/creation.js kind='writable' n=50000000 *** 8.08 % ±3.53% ±4.70% ±6.12%
streams/pipe.js n=5000000 1.95 % ±3.32% ±4.43% ±5.81%
streams/pipe-object-mode.js n=5000000 ** 4.76 % ±3.29% ±4.40% ±5.78%
streams/readable-bigread.js n=1000 -0.19 % ±3.43% ±4.57% ±5.97%
streams/readable-bigunevenread.js n=1000 0.49 % ±2.05% ±2.73% ±3.56%
streams/readable-boundaryread.js type='buffer' n=2000 0.98 % ±2.30% ±3.06% ±3.99%
streams/readable-boundaryread.js type='string' n=2000 0.32 % ±1.20% ±1.60% ±2.08%
streams/readable-readall.js n=5000 1.62 % ±2.92% ±3.89% ±5.09%
streams/readable-unevenread.js n=1000 -1.05 % ±2.03% ±2.70% ±3.53%
streams/writable-manywrites.js callback='no' writev='no' sync='no' n=2000000 *** 11.18 % ±1.51% ±2.01% ±2.62%
streams/writable-manywrites.js callback='no' writev='no' sync='yes' n=2000000 *** -18.20 % ±4.62% ±6.15% ±8.01%
streams/writable-manywrites.js callback='no' writev='yes' sync='no' n=2000000 *** 24.39 % ±2.88% ±3.85% ±5.05%
streams/writable-manywrites.js callback='no' writev='yes' sync='yes' n=2000000 0.52 % ±5.40% ±7.23% ±9.49%
streams/writable-manywrites.js callback='yes' writev='no' sync='no' n=2000000 *** 8.15 % ±1.76% ±2.35% ±3.05%
streams/writable-manywrites.js callback='yes' writev='no' sync='yes' n=2000000 *** -22.02 % ±3.14% ±4.20% ±5.50%
streams/writable-manywrites.js callback='yes' writev='yes' sync='no' n=2000000 *** 6.31 % ±2.80% ±3.74% ±4.87%
streams/writable-manywrites.js callback='yes' writev='yes' sync='yes' n=2000000 -1.93 % ±3.50% ±4.66% ±6.07%

@jasnell

jasnell commented Apr 23, 2020

Copy link
Copy Markdown
Member

@ronag .... it would appear that maybe one of the handful of streams related PRs you just landed may be having some CI issues: https://ci.nodejs.org/job/node-test-commit-linux/34504/

test-stream-pipeline consistently failing on Linux...

image

@ronag

Copy link
Copy Markdown
MemberAuthor

@ronag .... it would appear that maybe one of the handful of streams related PRs you just landed may be having some CI issues: ci.nodejs.org/job/node-test-commit-linux/34504

That's strange. I'm on it.

@ronag

Copy link
Copy Markdown
MemberAuthor

All of them have green CI, so it must be that one of them made the other fail.

@jasnell

Copy link
Copy Markdown
Member

Entirely possible. Just ran the tests a second time (with a different unrelated PR) and seeing the same failures. https://ci.nodejs.org/job/node-test-commit-linux/34506/

@ronag

ronag commented Apr 23, 2020

Copy link
Copy Markdown
MemberAuthor

Entirely possible. Just ran the tests a second time (with a different unrelated PR) and seeing the same failures. https://ci.nodejs.org/job/node-test-commit-linux/34506/

Yep, Working towards a PR to resolve it.

@ronagronag mentioned this pull request Apr 23, 2020
4 tasks
ronag added a commit to nxtedition/node that referenced this pull request Apr 23, 2020
While nodejs#31046 did make async
writes faster it at the same time made sync writes slower.
This PR corrects this while maintaining performance improvements.
ronag added a commit that referenced this pull request Apr 25, 2020
While #31046 did make async
writes faster it at the same time made sync writes slower.
This PR corrects this while maintaining performance improvements.
PR-URL: #33032
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
BethGriggs pushed a commit that referenced this pull request Apr 27, 2020
Refactors buffering in Writable to use an array
instead of a linked list.
PR-URL: #31046
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
BethGriggs pushed a commit that referenced this pull request Apr 27, 2020
While #31046 did make async
writes faster it at the same time made sync writes slower.
This PR corrects this while maintaining performance improvements.
PR-URL: #33032
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
@BethGriggsBethGriggs mentioned this pull request Apr 27, 2020
BethGriggs pushed a commit that referenced this pull request Apr 28, 2020
Refactors buffering in Writable to use an array
instead of a linked list.
PR-URL: #31046
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
BethGriggs pushed a commit that referenced this pull request Apr 28, 2020
While #31046 did make async
writes faster it at the same time made sync writes slower.
This PR corrects this while maintaining performance improvements.
PR-URL: #33032
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Zeyu Yang <himself65@outlook.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.streamIssues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

13 participants

@ronag@mscdex@nodejs-github-bot@BridgeAR@Trott@mcollina@mafintosh@jasnell@addaleax@wa-Nadoo@awibox@lundibundi@targos