Re: [whatwg/streams] WritableStreamDefaultWriterGetDesiredSize(writer) cannot in general be used to determine size of chunks read by pipeTo (#938)

> For TextDecoderStream, I want to set HWM to 1 to avoid adding unneeded buffering to the pipe. But if pipeTo() read 1 byte at a time, that would be pretty catastrophic for efficiency.

Hmmm, fair point. This seems like a more general issue with how desiredSize gets communicated along pipe chains and transform streams?? :-/ Like if I do

```js
byteReadable
  .pipeThrough(new TextDecoderStream())
  .pipeTo(new WritableStream(..., {
     highWaterMark: 1024,
     size(string) { return string.length; }
  });
```

then ideally you should be pulling ~1024 byte chunks (under an assumption of 1 code point ~ 1 byte), not 1-byte chunks...

I'm not sure the infrastructure there would be tractable or desirable to build, but it might be worth exploring? Or maybe I'm thinking of this all wrong in some way...

-- 
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/938#issuecomment-410288522

Received on Friday, 3 August 2018 15:26:56 UTC