Re: Using ArrayBuffer as payload for binary data to/from Web Workers

On Mar 7, 2011, at 3:54 PM, Glenn Maynard wrote:

> On Mon, Mar 7, 2011 at 6:05 PM, Chris Marrin <> wrote:
> Now that ArrayBuffer has made its way into XHR, I think it would be reasonable to somehow use this new object type as a way to pass data to and from Workers without copying. I've seen hints and thoughts about this here and there, but I've never seen a formal discussion. I'm not even sure if webapps is the place for this discussion, although it seems like a reasonable place. Please let me know if there is a better place.
> ArrayBuffer is the most obvious use for zero-copy messaging, but I don't think it should be limited to it...
> Has there been discussion anywhere that I've missed?
> Probably not the only one, but check the "WebWorkers and images" thread on whatwg.

Yeah, I thought about that case. The extra complication there is that images are rendering resources, which muddies the issues some. If the 2D Canvas API were able to use ArrayBuffer data as an image source like WebGL can, then we could kill 2 birds with one stone. Pass the ArrayBuffer to the worker and have it generate some image data, then pass it back and render it to a canvas. You could even split the array buffer into tiles and have multiple workers operate on the tiles. 


Received on Tuesday, 8 March 2011 01:05:03 UTC