-
Notifications
You must be signed in to change notification settings - Fork 30k
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: fix sync write perf regression #33032
Conversation
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.
@@ -421,27 +421,24 @@ function onwrite(stream, er) { | |||
onwriteError(stream, state, er, cb); | |||
} | |||
} else { | |||
if (!state.destroyed) { | |||
if (state.buffered.length > state.bufferedIndex) { |
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.
since clearBuffer
is not inlineable this condition removes a lot of the overhead of calling into clearBuffer
clearBuffer(stream, state); | ||
} | ||
if (state.needDrain || cb !== nop || state.ending || state.destroyed) { |
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.
This condition was an optimization which did not add much if any value and made the code more complex.
|
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.
RSLGTM
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
Landed in ab7d9db |
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
While #31046 did make async writes faster it at the same time made sync writes slower.
This PR corrects this while maintaining performance improvements.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes