-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
stream: pipe lazy drain #29095
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: pipe lazy drain #29095
Conversation
99c0615 to
9bf7643
Compare
3355012 to
10fe46a
Compare
b3be9d3 to
e81f6c2
Compare
|
Mixing |
e81f6c2 to
c8da80a
Compare
c8da80a to
45bac8d
Compare
|
Why do you think this is a optimization? |
|
It skips the extra allocation and lookup. |
mcollina
left a comment
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 with green CITGM
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.
Why was this removed?
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.
Mixing pipe with 'readable' is a nono since registering readable messes with state.flowing.
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'm actually not sure what this is supposed to test and whether is even valid?
836880a to
60067c6
Compare
60067c6 to
59eb36c
Compare
Results are decidedly "no significant change in performance detected". None of them came in with a p-value lower than 0.05. 13:47:22 confidence improvement accuracy (*) (**) (***)
13:47:22 streams/creation.js kind='duplex' n=50000000 0.42 % ±2.59% ±3.44% ±4.48%
13:47:22 streams/creation.js kind='readable' n=50000000 0.61 % ±4.21% ±5.65% ±7.45%
13:47:22 streams/creation.js kind='transform' n=50000000 -0.14 % ±2.46% ±3.29% ±4.31%
13:47:22 streams/creation.js kind='writable' n=50000000 -2.13 % ±3.29% ±4.37% ±5.69%
13:47:22 streams/pipe.js n=5000000 1.55 % ±3.43% ±4.56% ±5.95%
13:47:22 streams/pipe-object-mode.js n=5000000 1.41 % ±3.66% ±4.87% ±6.34%
13:47:22 streams/readable-bigread.js n=1000 -1.95 % ±2.44% ±3.24% ±4.22%
13:47:22 streams/readable-bigunevenread.js n=1000 6.89 % ±14.51% ±19.31% ±25.15%
13:47:22 streams/readable-boundaryread.js type='buffer' n=2000 -0.89 % ±2.11% ±2.81% ±3.66%
13:47:22 streams/readable-boundaryread.js type='string' n=2000 -0.15 % ±1.98% ±2.64% ±3.43%
13:47:22 streams/readable-readall.js n=5000 -0.29 % ±1.98% ±2.64% ±3.43%
13:47:22 streams/readable-unevenread.js n=1000 -1.07 % ±1.85% ±2.48% ±3.25%
13:47:22 streams/writable-manywrites.js n=2000000 0.54 % ±5.16% ±6.87% ±8.94%
13:47:22 |
|
(Of course, maybe the benchmark isn't significantly exercising the optimization here?) |
|
CITGM on master: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1949/ CITGM on this PR: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1950/ |
|
Landed in 7195cd6 |
PR-URL: #29095 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #29095 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Slight optimization. Don't allocate and register the drain function for fast consumers.
Related #29087
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesNOTE TO SELF: After this has been merged, look into removing unnecessary
onclose.