Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So how much faster than JS is Wasm for typical use-cases?


That's a bit of a trick question - typical use case for each is different, you don't use these interchengably, it doesn't make that much sense.

Typical use case for JS is let's say a glue between network and DOM, where it doesn't really do much, most of that work is done by the browser anyway. If you add wasm to that, you'll just add one more indirection through the wasm sandbox and it'll probably be slower in many cases, because you have to copy data.

Typical use case for Wasm is either porting existing native programs or something compute heavy. Figma uses this for the native layer, I used it for some image processing use cases or for board game solver backend. Doing that in JS is slower because JS semantics are not straightforward to optimize, even for basic numerical operations. I found something around 3-10x speedup for this kind of code is pretty common, but it depends on what it is doing - whether JS can represent the types and operations well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: