-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: refactor to use more primordials #36346
Conversation
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.
These changes result in performance regressions:
confidence improvement accuracy (*) (**) (***)
streams/creation.js kind='duplex' n=50000000 *** -20.52 % ±1.74% ±2.32% ±3.03%
streams/creation.js kind='readable' n=50000000 *** -2.90 % ±1.60% ±2.14% ±2.79%
streams/creation.js kind='transform' n=50000000 *** -40.53 % ±2.19% ±2.94% ±3.87%
streams/creation.js kind='writable' n=50000000 *** -17.87 % ±2.23% ±2.97% ±3.87%
streams/readable-bigunevenread.js n=1000 *** 36.67 % ±9.91% ±13.19% ±17.18%
streams/readable-unevenread.js n=1000 *** -53.23 % ±1.50% ±2.00% ±2.60%
streams/writable-manywrites.js len=1024 callback='no' writev='no' sync='no' n=2000000 *** -8.27 % ±0.93% ±1.24% ±1.61%
streams/writable-manywrites.js len=1024 callback='no' writev='yes' sync='no' n=2000000 *** -15.26 % ±2.33% ±3.13% ±4.12%
streams/writable-manywrites.js len=1024 callback='yes' writev='no' sync='no' n=2000000 *** -5.86 % ±1.13% ±1.51% ±1.97%
streams/writable-manywrites.js len=1024 callback='yes' writev='yes' sync='no' n=2000000 *** -11.91 % ±1.70% ±2.27% ±2.98%
streams/writable-manywrites.js len=32768 callback='no' writev='no' sync='no' n=2000000 *** -3.08 % ±1.55% ±2.07% ±2.69%
streams/writable-manywrites.js len=32768 callback='no' writev='yes' sync='no' n=2000000 *** -5.16 % ±2.19% ±2.92% ±3.82%
Perhaps we should stop using |
@mcollina does this introduce concerns for |
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, I'll deal with it somehow in readable-stream. This ship has sailed long ago.
(Note that using so many primordials will cause problems in jest).
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.
Actuall no, this should not land given the perf regressions. Good spot @mscdex!
5691ce5
to
1ea7378
Compare
This comment has been minimized.
This comment has been minimized.
@mscdex @mcollina I've spotted what changes where causing the perf regressions and I've revert them. I think this is ready to land now PTAL. Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/808/ Benchmark results
|
c96d03a
to
8015a72
Compare
Another benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/847/
|
Dismissing for unresponsiveness.
@mcollina @mscdex I've dismissed the change requests as I believe I've addressed your objections already and my pings haven't received any response in more than seven days. If you want to have another look to give this PR a green mark or want to clarify you are still objecting, you're of course welcome to do so :) |
8015a72
to
b93fda8
Compare
node/lib/internal/streams/buffer_list.js Lines 82 to 83 in c746c40
Should we use StringPrototypeSlice here too?
|
That's what I did originally and I reverted it in b93fda8 for performance reason. |
|
I've already ran a benchmark CI for #37126 which does include the changes in this PR and got acceptable results, see #37126 (comment). I don't think it's necessary to run another benchmark, and I'd be happy to skip it if people in this thread agree. |
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.
Not blocking - just pointing out that the reason this is taking you long to land is that the streams people (me included) don't feel as strongly about the primordial stuff as they do about not breaking the ecosystem (since everything builds on streams) and this PR has breakage potential.
Just writing it down so you don't think you are being ignored - these sort of changes are just very scary (in terms of potential breakage) and somewhat complicate the code.
❤️
PR-URL: nodejs#36346 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
f72fa25
to
419686c
Compare
Landed in 419686c @benjamingr Thanks for your message! I understand the concerns, and I'm willing to work to help solve any breakage that might arise from these changes. |
I don't think this should have been landed without a @nodejs/streams approval. We must check if this causes any regressions and consider a revert. I've added a bunch of dont-land tags so we can investigate before backporting. |
What do you think @nodejs/tsc? |
CITGM of master: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/2606/ |
I've opened a revert PR here #37168, we can run benchmarks on top of it to test the impact of this PR. FWIW I've run several benchmarks myself to remove all changes that was causing perf regressions and I've removed those in b93fda8. There is also a recent benchmark CI that was run and didn't show any significant perf regression (https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/913/). |
I'm confused, did benchmarks not run after the last changes here? Edit: I think they did run "on top" of it in https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/913/ |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes