stream: fix sync write perf regression#33032
Closed
ronag wants to merge 1 commit intonodejs:masterfrom
Closed
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.
ronag
commented
Apr 23, 2020
| } | ||
| } else { | ||
| if (!state.destroyed) { | ||
| if (state.buffered.length > state.bufferedIndex) { |
Member
Author
There was a problem hiding this comment.
since clearBuffer is not inlineable this condition removes a lot of the overhead of calling into clearBuffer
ronag
commented
Apr 23, 2020
| if (state.buffered.length > state.bufferedIndex) { | ||
| clearBuffer(stream, state); | ||
| } | ||
| if (state.needDrain || cb !== nop || state.ending || state.destroyed) { |
Member
Author
There was a problem hiding this comment.
This condition was an optimization which did not add much if any value and made the code more complex.
Collaborator
Member
Member
Author
|
jasnell
approved these changes
Apr 23, 2020
mscdex
approved these changes
Apr 23, 2020
himself65
approved these changes
Apr 24, 2020
Collaborator
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>
Member
Author
|
Landed in ab7d9db |
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>
Merged
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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