-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examine interaction of resizable array buffers with Streams #1248
Comments
My initial assessment based on reading the proposal is that there is no impact on default streams, only byte streams. As far as I can tell, because we detach the buffer in So my tentative conclusion is that we don't have to change anything. It might be worth writing some tests once Node supports it. |
Should Looking at our current TransferArrayBuffer helper, it looks like it won't have the necessary |
I hadn't thought of that. I agree that developers will expect to get a resizable buffer back. |
Good catch. I filed tc39/proposal-arraybuffer-transfer#3 on making that easier from a spec perspective. |
I haven't investigated this deeply, but regarding the discussion at tc39/proposal-arraybuffer-transfer#3, I wonder if it might actually be possible to take advantage of resizable buffers in the streams API to make it more pleasant to use? That is, are there technically-backward-incompatible, but probably-real-world-compatible changes we could make, that would let us stop creating so many different ArrayBuffers? I guess userland streams are the real crux. @syg, is there any way to get this behavior, using spec/implementation primitives introduced by the resizable buffers proposal? (Not necessarily restricted to public JavaScript APIs.) const ab1 = constructAB();
const ab2 = transferMemoryFrom(ab1);
// at this point ab1 must act as if it's transferred
// ... now developer code manipulates the contents of ab2 ...
switchMemoryBackToAB1();
// at this point ab2 must act as if it's transferred,
// and ab1 must reflect any modifications that were made to the backing memory. The other area I wonder about, is whether we could/should use the resizable buffers primitives to replace our practice of vending smaller ArrayBufferViews onto the backing ArrayBuffer, to reflect how many bytes we used. Probably not, but maybe worth some thoughts... |
Resizable array buffers are described here:
https://github.com/tc39/proposal-resizablearraybuffer/blob/master/README.md
This issue is to track compatibility issues between resizable array buffers and streams.
The text was updated successfully, but these errors were encountered: