Improving WebXR Performance/Multi threading Javascript Runtimes

hey guys , I have been exploring options to multi thread javascripts using webworker/Atomic api to help improve webxr scene.Do you think multi threading javascript runtimes would work with mojo??
9 Replies
Alex Gunnarson
Alex Gunnarson•7mo ago
Mojo could in theory be compiled to WebAssembly (not sure whether that's been done before or where that is on the roadmap if not). Once that happens, you could then run the Mojo-based WASM code in your Web Workers to speed up whatever needs to be done there.
ModularBot
ModularBot•7mo ago
Congrats @Alex Gunnarson, you just advanced to level 2!
Alex Gunnarson
Alex Gunnarson•7mo ago
However, it may be non-trivial. Also the dev flow would be laborious (edit Mojo code, recompile to WASM, reload WASM in browser) without some sort of auto-reloader script.
Alsala Ahmed🚀(he/him)
Thanks Alex !!! maybe we may achieve it soon.
Alex Gunnarson
Alex Gunnarson•7mo ago
No problem!
Alsala Ahmed🚀(he/him)
Alex I was thinking of starting an open source project on hot reloading and compilation of webassembly kinda browser which is purely for webxr(somewhat like wolvic) an XR Experience focused browser can you give me some pointers
Alex Gunnarson
Alex Gunnarson•7mo ago
That would be awesome! You should generalize it to beyond just WebXR and make it work for any WebAssembly context 🙂 Off the top of my head, you'll need something like: - A WebSocket connection from the browser to a server. The browser listens for messages from the server that contain WASM code. When WASM is received, it hot-swaps it in (not sure what the API for consuming WASM in the browser is, but it's widely available). - A server that's listening to a particular directory (java.nio.file.WatchService or something) with the WASM file(s). When a change is detected, it sends the WASM contents via a WebSocket message to the browser. Maybe you want a progress animation, too, for when the compilation is occurring. So if you have something emitting WASM, it can send messages to the server reporting its progress. Would be better than just a file watcher.
Alsala Ahmed🚀(he/him)
Thanks a lot!!! I will start the project and share the repo soon here!!!
Alex Gunnarson
Alex Gunnarson•7mo ago
Awesome!! Good luck 🙌
Want results from more Discord servers?
Add your server