Why would Wasm engines need to do inlining and dead code elimination? My impression was that Wasm is basically native level-code, save for register allocation, and some arch-specific peephole optimizations. Dead code elimination is the job of the C++ compiler.
Generally, I don't disagree, but not all producers are LLVM. And JS inlining is driven by dynamic heuristics, speculatively inlining likely candidates, whereas statically-compiled C++ code generally doesn't have speculative inlining. So a Wasm call_indirect will not get dynamically optimized into a guarded inline.
Re:WebAssembly 2.0 First Working Draft
by native_samples on Tuesday April 19, 2022 @04:26PM
(#31088565)
Isn't SIMD new in this release of the spec? How can WASM crush JS using SIMD if they only just added support?
It's been implemented in browsers for longer than the spec has been out. In fact, one condition of a proposal being merged into the spec is that two production engines must have implemented it.
With SIMD and threads, Wasm can absolutely crush JS performance.
https://www.infoq.com/articles/webassembly-simd-multithreadi...