Could someone explain what this is? All I've found in search is talk about how much faster it is. Devs write code in C/C++ and target js? Is that it?
Could someone explain what this is? All I've found in search is talk about how much faster it is. Devs write code in C/C++ and target js? Is that it?
As a result, it can be AOT-compiled to machine code rather efficiently and lead to excellent performances with special support, while still being 100% compatible with browsers providing no special support (as it's a subset).
The idea is to make it an efficient (if low level) language to use out of the box, and an efficient compilation target for higher-level non-javascript languages (C and C++ are used for comparisons but e.g. clojurescript or elm could compile to asm.js as well instead of their current javascript target).
Basically, as the name implies asm.js tries to be an assembly for the web, but a backwards-compatible one (as opposed to NaCl)
Any and all asm.js code has the same semantics as regular JavaScript. This is the most important thing about it--it already runs, everywhere. If a browser gets an asm.js runtime, the only thing that changes is speed.
Asm.js code is very, very low-level. Pretty much the only operations supported are statically-typed arithmetic, and array load/stores. It doesn't use any dynamic behavior--the closest it has, is arrays of functions that must have identical signatures, so that you can implement vtables yourself. Its resemblance to assembly is intended to make it a better compiler target.