- From: Takeshi Yoshino <notifications@github.com>
- Date: Tue, 17 Feb 2015 21:58:15 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/issues/253/74817246@github.com>
> Separate question, @tyoshino: in #275 (comment) and #253 (comment) you said you think read(2)-backed ReadableByteStreams will be backed by a one-element queue. I don't quite understand why this would be the case? It seems better to have readInto() (or, maybe, feedArrayBuffer()) directly call to read(2), instead of having the queue. In the first comment, I introduced `.amountReadable` for I/Os that can tell us how many bytes can be read. I didn't mean that we should call `read(2)` in advance and determine how many bytes can be read. I think for `read(2)` backed stream, I'd return **undefined** on `.amountReadable` call. In the second comment, I tried to unify interface for `read(2)` backed one and `fread(3)` backed one by using only one method `feedBuffer()`, and I said `feedBuffer()` will put the given buffer to a queue. We can make the ReadableStream's state `"readable"` synchronous to `feedBuffer()` call by completing `read(2)` immediately after the push of the fed buffer to the queue. So, this is equivalent to `readInto()` in terms of efficiency (though cumbersome that we need two steps). --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/253#issuecomment-74817246
Received on Wednesday, 18 February 2015 05:58:42 UTC