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

Thinking about it, there's a potential conflict between allowing detaching in the consumer and enabling zero-copy in certain cases.

What if something like a GrepTransformStream receives an ArrayBuffer containing, say, 3.5 lines of text. It then wants to give the consumer the 1st line and the 3rd, but not the 2nd, or the remainder which hasn't hit a 4th newline yet. They'd just be two views into the same underlying buffer. Detaching either would wreck the other right? What about a way to provide a reader with an array of views, all into the same buffer?

It's a use case BYOB didn't have to worry about, in the other direction.

Actually if the stream needs the 'remainder' at the end of the buffer to concatenate with the next chunk of bytes it receives, I guess it would have to copy at least that small amount.

-- 
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-257128032

Received on Sunday, 30 October 2016 02:26:05 UTC