stream: refactor clearBuffer and writableState#45682
stream: refactor clearBuffer and writableState#45682anonrig wants to merge 2 commits intonodejs:mainfrom
Conversation
|
Review requested:
|
|
Doesn't seem to be reproducible. A re-run of the benchmarks shows: |
Thanks for the update @mscdex. Do you have any particular reason for this flakiness? I've added a new commit and re-run the benchmark CI. If it's still the same, I'll update the description and remove the references to the benchmark results. |
No, but it's always best to re-run the benchmarks several times to ensure consistent results. |
| const len = objectMode ? 1 : chunk.length; | ||
| doWrite(stream, state, false, len, chunk, encoding, callback); | ||
| } while (i < buffered.length && !state.writing); | ||
| } |
| return; | ||
| } | ||
|
|
||
| state.bufferProcessing = true; |
There was a problem hiding this comment.
I don't understand why this is better?
There was a problem hiding this comment.
Unnecessary length operation was done before state.bufferProcessing assignment is done. This change eliminates that.
There was a problem hiding this comment.
I still don't see it. This is actually slower for the case where bufferedLength is 0... since it unnecessarily sets and unsets bufferProcessing.
This pull request refactors
clearBufferfunction and removes the unnecessarytypeof isDuplexcheck on WritableState class.