In many cases, Asm.js code can be compiled into native binaries that execute as fast as code written in C or C++ – as evidenced by impressive 3D gaming demos like the one that was developed jointly by Mozilla and Unity earlier this year.
To gain the benefits, though, explicit support for Asm.js must be built into the browser. And while support is already present in Firefox and Chrome (albeit reluctantly), Microsoft hasn't said much about it until now.
In a Thursday blog post, Microsoft's Edge team said Asm.js support was one of the ten most requested features submitted to the Microsoft Edge Developer Suggestion Box. What's more, not only has Redmond listened, but experimental Asm.js support is already available in the version of Edge that shipped with the current version of the Windows 10 Technical Preview, Build 10074.
To enable it, all you need to do is enter "about:flags" into the URL bar and tick the box next to the relevant option under the browser's list of experimental features.
It's the box at the bottom
Among the new components is an Asm.js validator that ensures that code marked as being Asm.js actually complies with the spec. It also has a new generator that outputs Type Specialized bytecode, which takes advantage of the fact that Asm.js only supports architecture-native data types like integers, floats, and doubles to speed up execution. Chakra's JIT compiler has also been optimized to add extra acceleration Asm.js code that's output by the LLVM compiler backend.
The Edge team's blog post goes into more detail about how Chakra's new features help push the pedal to the metal when executing Asm.js code. Suffice it to say that Edge means to be fast. Microsoft says it already performs 300 per cent faster on the Unity Benchmark and 200 per cent faster on other benchmarks than it did before Asm.js support was enabled. To check it out, you can put the new browser through its paces on some 3D games and other demos.
The work isn't done, though, and Microsoft says it plans to gather more data from the preview builds of Edge to determine whether its current approach to Asm.js is working before enabling support by default.