27 ms·
Isn't Wasm just stuff transpiled to javascript and then pre-interpreted to bytecode anyway? The ole' Emscripten console port.
by moffkalast 4y ago
Isn't Wasm just stuff transpiled to javascript and then pre-interpreted to bytecode anyway? The ole' Emscripten console port.
- deathanatos 4y agoNo. WASM is its own byte-code, which can be either interpreted directly, or JIT'd to machine code. There's no transpile to JS step. (There's a text representation too.)
- moffkalast 4y agoWait was that asm.js then? It's so confusing, I swear that each time I check I find people claiming different things about this.
- lxgr 4y agoasm.js is something of a spiritual predecessor to WASM. The neat thing about it is that it's both syntactically and semantically valid JavaScript, but also compiles to native code much more directly than JavaScript generally does. WASM is essentially a successor to asm.js that is not valid JavaScript anymore – browsers do need to provide a different runtime for it. I believe some early WASM runtimes did reuse parts of their JS stack for JIT compilation, but I believe this is no longer the case, since WASM can efficiently be AOT compiled (unlike JS, which does need the JIT to be efficient due to its much more liberal type system, among other things).