Re: [whatwg/streams] Could a byte stream read directly into and out of a SAB (w/o transfer)? (#757)

> I am actually not sure I understand the proposal here. I can see two things we can do with SABs:

I'm not sure those two are in conflict. (1) is what the proposal in this thread is, in that it has observable effects on the developer experience of using streams. (Object identity gets preserved, which is easier to work with than having to constantly switch what `ArrayBuffer` you're operating on, even if the backing memory stays the same.) Whereas (2) seems like something an implementation could do behind the scenes with no observable effects, as long as it has the ability to create JavaScript `SharedArrayBuffer` objects that are backed by existing chunks of memory.

Indeed, I think (2) is maybe doable even with the current spec, with just normal `ArrayBuffer`s?

The only tricky thing I can imagine is that the contents of the AB/SAB need to only visibly change to JavaScript at well-defined points (essentially, after `read(view)` calls). That still seems doable with a sufficiently-advanced ArrayBuffer <-> backing memory mapping, but we're getting in to territory I'm not well versed in. Maybe (2) is about loosening that invariant?

-- 
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/757#issuecomment-509297758

Received on Monday, 8 July 2019 16:31:11 UTC