Hacker News new | ask | show | jobs
by davidmurdoch 863 days ago
I always wonder how much faster JS could be if the effort that went into WASM went into JS. ASM.js, SIMD, snapshots, etc directly in JS could have really made it a serious contender for high-performance software.

Of course, without WASM, we'd be missing out on lots of cool software that was previously stuck on desktop/native. But I'm not entirely convinced it was the right path.

3 comments

They did try to do SIMD in JS, and the proposal made it as far as being implemented in browsers, but it ended up being hideously convoluted in practice so it was killed in favor of WASM SIMD.

The MVP implementation of SIMD.js grew to about 10% of V8s entire codebase, just for the bare minimum "it runs" support without optimisations.

How large is WASM? and how convoluted are the implementations and the integrations now?
Ballparking it based on the relative LOC of v8/src and v8/src/wasm, about 8%. That's for everything WASM though, not just the SIMD support, and it's a fully optimized and production-ready implementation.
JS being abused as a compilation target is definitely not a long-term strategy for the web. Going forward we need less emphasis on JS and more on HTML and WASM.
I'd like even more emphasis on JS, personally.
> Of course, without WASM, we'd be missing out on lots of cool software that was previously stuck on desktop/native.

Maybe not. Someone could have written a backend for GCC and/or LLVM that targets JS in the same way that Emscripten targets WASM (with JS around the edges).