Asm.js just got faster

    Mozilla company is pleased with the news about the next performance improvement asm.js . This intermediate language provides extremely high speed of code execution written in languages ​​like C and C ++, is a free alternative to the Google Native Client and works in any browser (although it is the fastest in Firefox).

    For example, after compiling C ++ code in Asm.js using the Emscripten compiler, earlier the performance loss was about two times higher, now Asm.js code is no more than 1.5 times slower than the native program.

    Some of the optimizations performed are small and insignificant, while others are more serious. For example, Firefox recently learned to optimize certain floating point operations so that instead of float64 numbers, calculations are performed with less accurate float32 numbers, which gives a very big increase in performance. The corresponding change was made to Asm.js, the Emscripten compiler and the SpiderMonkey engine.

    The diagram shows the speed of operations in different environments, relative to clang 3.2 (taken as a unit). Less time corresponds to a better result.



    Red shows Firefox with generated Emscripten code using 32-bit numbers (firefox-f32). As you can see, operations on Asm.js are performed very close to the native speed in the operating system. The maximum difference is these same 1.5 times, and in some cases Firefox shows even better performance!

    The developers promise to continue optimization further, although now, for example, the Unreal Engine 3 engine runs fine in the browser. At one time, this was one of the first demonstrations of Asm.js.


    Also popular now: