Re: [whatwg/streams] Performance optimization: `ReadableStreamDefaultReader.prototype.readMany` (Issue #1236)

>  introducing a new kind of Reader is the right way to accomplish this

Yeah, that makes sense. 

> I've been considering the possibility of a new kind of reader that implements the [Body mixin](https://fetch.spec.whatwg.org/#body-mixin)
> const reader = new ReadableStreamBodyReader(readable);

This is nice. Only thought here is maybe `getReader("body")` would be nice to have, too.

> The ReadableStreamBodyReader would provide opportunities to more efficiently consume the ReadableStream without going through the typical chunk-by-chunk slow path and would not require any changes to the existing standard API surface.

Thinking more on this today – I think this problem needs to be addressed in the controller more so than the reader. The problem is that the reader can't tell the controller what it wants to do because the controller starts doing work before the reader is acquired. 

I think a new controller type would work be more effective, but  `ReadableStreamBodyReader` would also be nice

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1236#issuecomment-1156216050

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1236/1156216050@github.com>

Received on Wednesday, 15 June 2022 09:16:27 UTC