3 ms·
Great piece, OP. We work in WASM and are considering web workers to help with rendering documents off the main thread in that context. I was surprised to read t
by piker 24d ago
Great piece, OP. We work in WASM and are considering web workers to help with rendering documents off the main thread in that context. I was surprised to read that ArrayBuffer is moved by reference only! Might be an option. Thanks for putting this together.
- deleted 24d ago[deleted]
- gioandthemachin 24d agohaven't done this for documents, but for canvas rendering transferControlToOffscreen() worked better than moving ArrayBuffers. It hands the canvas to a worker that draws directly, no pixles over postMessage at all.
- bastawhiz 24d agoArrayBuffer is copied by default unless you pass it as a special transferable object. But only the current owner of the buffer can use it. If you need to read and write from both threads at once, you need to look at SharedArrayBuffer.