Re: [whatwg/streams] Brainstorming a buffer-reusing version of writable streams (#495)

Sorry, I was unclear and it took me a while to figure out how to clarify.

Designing a buffer-reusing version of writable streams, KYOB, implies you need a way to signal when the underlyingSink, and any further downstream consumer in the pipe chain, is done with the buffer; and in the grep case, or any similar one, it's desirable to be able to have the same buffer back multiple views for the downstream consumer. A "non-byte readable stream" would have *no* way to signal when the consumer is done with that array of views, so it's not really the same idea at all. I should've more explicitly mentioned this being a RKYOB/PRTB idea, since that was the point of providing all the views together in an array atomically, so when the `promiseWhenDoneReading()` fulfills (or whatever way we pick to signal 'done') the backing buffer for all of them can be reused.

I was thinking, given the case of transforms that simply insert/remove ranges of bytes, what API would let them a) return buffers to the original source, b) avoid pointless copying? Current detaching byte streams wouldn't work, and default streams don't have a way to return buffers.

-- 
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/495#issuecomment-266178849

Received on Saturday, 10 December 2016 04:45:42 UTC