3 ms·
I just wish WASM could use more than one ArrayBuffer at a time. Would eliminate unnecessary copying for interop with JS code.
by Dwedit 2y ago
I just wish WASM could use more than one ArrayBuffer at a time. Would eliminate unnecessary copying for interop with JS code.
- Dwedit 2y agoWell I just thought of something obvious... Have a function that lets you pass in an ArrayBuffer, then it brings it into the virtual address space of the WASM program. Function would return the virtual address that was assigned to that array buffer. From there, you call into WASM again with that pointer, and the program can take action. Then there would be another function to relinquish ownership of the ArrayBuffer.
- throwaway290 2y agoThere's no SharedArrayBuffer support? Or I misunderstand the idea
- flohofwoe 2y agoThere is, but then you'd need to declare the entire WASM heap as a single SharedArrayBuffer. It only makes sense for shared-memory multithreading (but not that support for SharedArrayBuffer only works in 'cross-origin isolated' contexts). There is a related 'multiple memories' proposal btw: https://github.com/WebAssembly/multi-memory https://github.com/WebAssembly/multi-memory