But how is WASMfast and cross-platform simultaneously?
Does it pack multiple precompiled binary executables for multiple CPU vendors, like Apple's Universal Binary?
But then, whenever a new type of CPU gets announced, they wouldn't be able to run existing WASMs
WebAssembly's runtime environments (RE) are low-level virtual stack machines (akin to JVM or Flash VM)
Seems like WASM is closer to intermediate Java Byte Code instead of the genuinely low-level Assembly.
But then, why is it faster?
JS Interpreter can skip the parsing
It can ship in a much more compact file format
WASM is just like Java Byte-code. Java Byte-code is cross-platform when machine code for a real CPU is not. It's input for a JIT compiler that targets whatever real CPU. Peter Cordes
To run WASM, the browser must still compile the WASM code into ASM code when executing; in that way, it is much slower than WASM.
However, WASM is designed similarly to ASM. Therefore, compilingWASM to ASM targeting x86, ARM, and RISC-V, is comparably easy, and existing compilers emitting ASM can also emit WASM with a reasonable modification.