Re: [whatwg/streams] Allow other specifications to create readable byte streams (#1121)

> It takes a mandatory autoAllocateChunkSize. (Although maybe consumer specs would just set that to an implementation-defined value anyway, so perhaps we should have streams do that as a default instead of making it mandatory?).

I think making the implementation-defined value part of the streams specification would give the idea that this value must be the same for *all* streams. I assume that different specifications can have different "expected" chunk sizes (e.g. Fetch in Chromium will likely keep chunking at 64 KiB, but Web Serial might want smaller chunks by default), in which case a mandatory argument would make more sense. But I'm not a consumer spec author, so I could be wrong about this. 😅

> Or split up the bytes so that you respond to the BYOB request with the first N and then enqueue the rest?

Note that `ReadableByteStreamControllerEnqueue` already does this. 😉

In the limit, we could use "enqueue bytes" everywhere and remove "respond to BYOB request" entirely, instead leaving it up to implementations if they want to optimize by responding to the BYOB request where possible. But I don't know if implementors will feel confident/motivated to figure out these possible optimizations on their own, so maybe the specification *should* require and define at least some of them? 🤷‍♂️



-- 
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/1121#issuecomment-814455451

Received on Tuesday, 6 April 2021 21:38:35 UTC