[whatwg/streams] Change default readableStrategy HWM to 0? (#777)

Currently a TransformStream with the default strategies adds two chunks of buffering to any pipe. I'd like to reduce that as much as possible. We can't reduce the HWM of the writableStrategy to 0 because it would have permanent backpressure preventing the pipe from working. However, reducing the HWM of the readableStrategy to `0` will work.

Advantages:
- Reduces the amount of "bufferbloat" induced by adding an extra transform to a pipe, making backpressure propagate faster.
- Makes transform() be read-triggered by default, reducing unnecessary work. However, as soon as you pipe the readable to something transforms will start happening, so it doesn't actually make much difference.

Disadvantages:
- Breaks a surprising number of tests. I haven't looked at it in detail, but I don't think any of the breakage is fundamental. The plus side is that this will identify a set of tests whose behaviour changes with backpressure, and then we can split them into with- and without- backpressure versions.
- TransformStream ends up with a different default from ReadableStream, which may cause some surprise.

I've thought of three variations for how to treat the third argument of TransformStream:
1. **undefined** gets converted to `{highWaterMark: 0}`. Anything else is passed to the ReadableStream constructor unchanged.
2. **undefined** and empty objects get converted to `{highWaterMark: 0}`. Anything else is unchanged.
3. **undefined** gets converted to `{highWaterMark: 0}`. Anything else that doesn't already have a `highWaterMark` property gets one added with value `0`.

I think I prefer the first one.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/777

Received on Friday, 25 August 2017 11:20:59 UTC