pchampin / sowasm

RDF playground using WASM-compiled Sophia
https://champin.net/2023/sowasm/
Other
7 stars 1 forks source link

Move execution of WASM code into a worker #7

Open pchampin opened 11 months ago

pchampin commented 11 months ago

On big inputs, the WASM functions sometime take a non negligible time, causing responsiveness problems.

An alternative would their execution into a worker.

vemonet commented 11 months ago

According to the wasm-bindgen docs:

At the time of this writing, only Chrome supports modules in web workers, e.g. Firefox does not

But as we have seen ourselves we are now able to use import directly in the <script> of an HTML file (that's how we import sophia wasm and the monaco editor)

And according to this website: https://caniuse.com/mdn-api_worker_worker_ecmascript_modules all modern browsers supports ES modules inside workers now. Firefox started supporting it since june 2023, which explains why the wasm-bindgen docs is not up to date. But that means it should be much easier to setup than what is currently documented!