-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
perf: optimize Writable #50012
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
perf: optimize Writable #50012
Conversation
|
Review requested:
|
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
| } else { | ||
| state.pendingcb--; | ||
| finishMaybe(stream, state, true); | ||
| if ((state.state & kEnding) !== 0) { |
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.
We may as well optimize needFinish?
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 think this is more about inlining.
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.
We could maybe inline needFinish but that would impact readability for little gain
1dfbfb5 to
dc1debf
Compare
anonrig
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.
🚀
|
The Node.js streams team keeps on optimizing Writable and Readable streams with more double-digit performance gains. In this version streams maintainer Robert Nagy lead an effort to further optimize streams by reducing the number of checks performed, using bitmaps and scheduling callbacks in a more clever way. ^ This is assuming the other streams changes land in the next version too |
|
Landed in 95b8f5d |
@benjamingr which other streams changes? |
Try to inline condition checks and try to avoid read state properties in hot paths.