3 ms·
Is WebAssembly related to asm.js? I don't like to compile stuff. But improving performance by writing certain functions directly in assembler or in a subset of
by TekMol 9y ago
Is WebAssembly related to asm.js?
I don't like to compile stuff. But improving performance by writing certain functions directly in assembler or in a subset of js would be awesome.
- giancarlostoro 9y agoYes: https://en.wikipedia.org/wiki/WebAssembly#Development https://en.wikipedia.org/wiki/WebAssembly#Development
- acemarke 9y agoIn a way, yes. asm.js was a deliberately limited subset of JS syntax. By adding a "use asm;" statement, you signaled to the JS engine that everything after that was limited to the asm.js subset, allowing it to simplify the parsing logic and use a fast path for loading the code. You would rarely write asm.js syntax by hand, but rather use it as a compiler output format. WebAssembly takes that further by defining a bytecode that the JS engine doesn't even have to parse, but can accept and work with more directly. This speeds up loading time. Also, loosely put, the way it's defined allows the JS engine to execute it faster. WebAssembly is definitely not intended to be written by hand. Languages like C++ and Rust can now compile to WebAssembly, allowing non-JS source code to be run in a browser. (There _is_ a textual representation of the bytecode as well.)
- brian-armstrong 9y agoCompiling stuff is awesome. I never want to discover my bugs at runtime.
- goatlover 9y agoEven when prototyping, exploring or doing one-offs? I'd rather have the flexibility in those situations.
- brian-armstrong 9y agoAbsolutely, yes. It's preferrable to trying to debug inexplicable glitches in the prototype that the compiler could have caught. And with incremental builds, compilation should be pretty lightweight anyway.
- wvenable 9y agoI'm not sure why it makes a difference. If it doesn't work when statically compiled it won't work when dynamically either. Given things like intellisense prototyping and exploring should be faster.