Its a simpler bytecode machine, with optimizations to native code and direct operations on memory blocks, as opposed all the additional book keeping js engines have to do (garbage collection for one).
I’m no interpreter/compiler expert but for what I have read, at least in theory there are cases where V8 or other very optimized JS engines could be faster, where the complier doesn't have the runtime data that the JIT does, so the JIT produces "better" machine code equivalent than the static comp. Not sure how real of thing that is in practice tho.
It pushes the onus of optimization on the compiler building the target, so with rust for example both the compiler frontend and LLVM are optimizing.
There is nothing that explicitly ties the browser to one runtime/engine.
Wasm still needs the JS runtime for now because wasm engines don’t have bindings to the browser apis.
“Back in the day” we had a thing called Java applets which were embedded Java apps, compiled to Java bytecode and running on the JVM.
But because JS (Coffee script) was the first runtime to get added in the browser, it became the defecto way to run code in the browser. And the whole web app infrastructure got bolted on top of that.
Mind you none of this was what the initial HTTP/web system was designed for. Nor was this something engineered with great foresight, all of it grew organically into the useful mess it is now.
how the fuck is rust in wasm faster than js?