Wondering about WASM

I’m curious if anyone has played with reimplementing PM’s internals using WebAssembly. We do some heavy calculations during certain updates, and based on using both JS and WASM versions of a few libraries, I suspect there’s the potential for significant performance gains using WASM for core calculations.

I’m curious about this as well! It seems like the challenge is that WASM API’s are async, whereas lots of runtime painting/calculations are sync. I did see that someone ported the state parts of ProseMirror to Golang, which might be a more practical/interesting entry point to seeing how you might shunt in ProseMirror-y functionality in a WASM runtime context!

I’ve also been wondering about using WASM for other client-side calculations that might otherwise happen server-side — like running a custom spellchecker on the client, to reduce latencies, and handling the async nature of this kind of calculation using some kind of generic transaction mapping logic.

…all interesting problems!

Hunspell-asm is amazingly fast if you want a custom spellchecker on the client.

Thanks for the ProseMirror-Go reference, I’ll take a look at that! Looks like they’re not focused on the client, but it would be a useful reference point.