-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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: sync writes don't need drain #29087
Conversation
ea33898
to
3412764
Compare
3412764
to
49102ae
Compare
@nodejs/streams |
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.
Good work! I agree that this is going to make things faster (however we will need benchmarks), but this is likely going to break users in many ways.
We can see this in the tests, where a bunch of nextTick had to be added. Do you think it would be possible to make this backward compatible?
@mcollina: I'm unsure how bad of a breaking change this actually is. The test "wrongly" assume that That being said. The only "fully" backwards compatible way I can think of is to do this as a hack for |
Then I think we should not implement this. We might decide to bring https://www.npmjs.com/package/syncthrough into core, as it solves the same problem in a non-breaking way. |
@mcollina: Fair enough... feel free to close |
Minor fix and performance improvement. Synchronous writes do not require drain.
This can be a significant improvement especially for transform streams that do not perform any async work.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesNOTE TO SELF: Sync transform streams should have a no buffer option (i.e. hwm === 0).