3 ms·
Wasm threads via SharedArrayBuffer have been a thing for like 5 years. In Rust you can use wasm-bindgen-rayon, for instance. DOM access is and has always been e
by nanaian 3y ago
Wasm threads via SharedArrayBuffer have been a thing for like 5 years. In Rust you can use wasm-bindgen-rayon, for instance. DOM access is and has always been easily achieved through imports. It's performant, too: https://youtu.be/4KtotxNAwME https://youtu.be/4KtotxNAwME
- apatheticonion 3y agoIt's __doable__ but I can't yet in earnest recommend it for a serious project (outside of canvas controlled GUIs). The SharedArrayBuffer implementation requires spawning the same wasm module multiple times and passing the SAB to each instance. This works but is no replacement for thread management by the module/process itself. It also requires restrictive "Cross-Origin-Opener-Policy" and "Cross-Origin-Embedder-Policy" headers - making it largely impossible for applications with multiple subdomains (for instance apps that have their API on api.myapp.com, or assets on cdn.myapp.com). Not an easy change for an established enterprise application. Glue code might be performant but I really just want to go > cargo build --target wasm and > <script src="app.wasm" type="application/wasm"></script>