- From: Domenic Denicola <notifications@github.com>
- Date: Fri, 26 Aug 2016 13:57:46 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/issues/495/242849739@github.com>
> Did you mean the time until resolution of the returned promise? I understood so as the example you provided is explaining such a scenario. What I meant is that you could imagine a design where write() fulfills with (a transferred version of) the buffer it was given, instead of with undefined. That would allow the example to keep reusing the same buffer instead of repeatedly allocating it. There might be other designs, but yeah, in general I think that after the promise is fulfilled, the buffer should be given back, at least in some cases. I think this ties in to what @ricea points out about sync vs. async by just normalizing everything to async... but I'm not sure. > Good point. tzik also pointed out that if we're using a big ArrayBuffer e.g. for Web Assembly, always transferring a given ArrayBuffer would be very problematic, before. Sorry for not creating an issue for discussing that earlier. Yeah. This might be a separate issue, but in general I agree that all this design would have been nicer if we could have partial detaching in the ArrayBuffer API. I proposed that in https://esdiscuss.org/topic/improving-detachment-for-array-buffers but didn't get any interest. I could try harder to make that work, maybe. Although I think that people are probably more excited about SharedArrayBuffer for now. Certainly if we allow streams to work with SharedArrayBuffer, we can get nice semantics where there are no transfers (but also things are potentially racy if you don't wait until the right signal before reusing the passed-in sections of the buffer). Maybe that is the way forward for this problem. -- 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-242849739
Received on Friday, 26 August 2016 20:58:14 UTC