1) Is it too early to adopt WASM for production use in a small company with limited resources?
2) If we did decide to go all in on WASM, what sort of gotchas might we be dealing with?
Thanks everyone!
1) Is it too early to adopt WASM for production use in a small company with limited resources?
2) If we did decide to go all in on WASM, what sort of gotchas might we be dealing with?
Thanks everyone!
It really depends on what you are doing with it.
For things like "I've got this C lib that I want to be able to call from the web" it's probably fine. For things like "I want to write my whole webpage in wasm" it's not ready for that (and, frankly, likely never will be).
It's a matter of finding the right fit.
> If we did decide to go all in on WASM, what sort of gotchas might we be dealing with?
Depends on what you mean by "all in" if you mean, "I want ALL my webapp logic to live in wasm" then the biggest gotcha you'll face is shipping stuff into and out of the VM (including DOM elements) is really painful. IMO, UX continues to best be done with Javascript or compile to javascript langauges (typescript, for example). Using a language like C, C++, or Rust to do UX work will simply not be pleasant, will be hard to hire for, and will complicate a lot of your build system.
Now, if by all in you mean "This logic only lives in this library and we are shipping that out as a WASM module" then I think wasm will work well there. Better, in fact, than other options like kotlin to native or J2CL (IMO).
That said, there are fledgling UX frameworks written entirely for WASM. However, they are all relatively young and AFAIK, not exactly well established.
This becomes an engineering decision and balancing act that I don't think can be 100% answered for your company.
I don't expect any of the UI work will ever be done in WASM (because it doesn't need to be shared with the embedded side of things). It is more porting standalone libraries that would be useful for both like file parsing and networking libraries. (In particular, the library I ported was a file parser).
WASM works best in cases of strict CPU and limited GPU processing (through webgl).
What already exists is multiple bridge libraries to make porting stuff from JS -> WASM and back again easier.
For example: https://rustwasm.github.io/wasm-bindgen/examples/dom.html
[0]: https://github.com/WebAssembly/gc/blob/main/proposals/gc/Ove...
It is a good way to get memory leaks, but a lot of websites already have those.
The big gotcha used to be debugging but Chrome dev tools actually has DWARF support now. Of course as an embedded developer you're probably already used to poor debugging support.