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

I don't think WASM is meant to replace JS, but you the tooling is such that you can use it to replace JS and have the JS glue generated for you. But it does seem that in a couple of years it'll be on-par performance-wise with javascript, without needing any JS glue autogenerated.

--------

WASM vs javascript performance is a multi-faceted beast.

DOM manipulation? Probably not going to be as fast in WASM because you'll need a javascript bridge, though the cost of calling between WASM and javascript has been greatly reduced. Firefox has a nice post about it [0], and IIRC, chrome made similar optimizations since then.

For more computationally intensive things though, WASM can beat javascript. Though that's still a little nuanced because if you really know what you're doing, you can write your javascript such that the optimizer can work really well. The firefox team put out a nice post detailing writing a hot path in WASM and getting almost a 6x speedup in their real-world-ish benchmarks (so, take that with a grain of salt)[1].

[0] https://hacks.mozilla.org/2018/10/calls-between-javascript-a...

[1] https://hacks.mozilla.org/2018/01/oxidizing-source-maps-with...



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

Search: