- From: Takeshi Yoshino <notifications@github.com>
- Date: Wed, 08 Apr 2015 07:14:48 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/issues/323@github.com>
(based on @yutakahirano's analysis) An identify transform can be designed to pass the `ArrayBufferView`s (after detaching) written to the writable side as-is to the readable side. This is good since no copy happens. We have three choices in implementing this: - (a) on `.write()`, the transform takes ownership of the `ArrayBufferView` permanently - (b) on `.write()`, the transform takes ownership but returns it later (notify ownership release by fulfilling the promise returned by `.write()`) - (c) on `.write()`, the transform reads out all the bytes from the `ArrayBufferView`. It never takes ownership. (a) allows the transform to pass the `ArrayBufferView` as-is (after detaching) to the consumer through `ReadableStream` without ack capability (non-BYOB), but disallows the producer to reuse the buffer. (b) allows the producer to reuse the buffer, but if the readable side is `ReadableStream` without ack capability (non-BYOB), there's no way to get the buffer returned by the consumer, so, we need to copy data inside the transform. To eliminate copy, we need `ReadableStream` with ack. When BYOB reading is used, we anyway need to copy bytes. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/323
Received on Wednesday, 8 April 2015 14:15:18 UTC