You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An identity transform can be designed to pass the ArrayBufferViews (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.
The text was updated successfully, but these errors were encountered:
(based on @yutakahirano's analysis)
An identity 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:
.write()
, the transform takes ownership of theArrayBufferView
permanently.write()
, the transform takes ownership but returns it later (notify ownership release by fulfilling the promise returned by.write()
).write()
, the transform reads out all the bytes from theArrayBufferView
. It never takes ownership.(a) allows the transform to pass the
ArrayBufferView
as-is (after detaching) to the consumer throughReadableStream
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 needReadableStream
with ack.When BYOB reading is used, we anyway need to copy bytes.
The text was updated successfully, but these errors were encountered: