Paul Krill
Editor at Large

Asm.js JavaScript subset picks up the pace against C/C++

analysis
Dec 23, 20132 mins

Mozilla-backed Asm.js narrows the performance gap with C/C++, cutting the speed advantage in half

Asm.js, a Mozilla-driven subset of JavaScript geared toward improving Web application performance and extending the Web to C and C++ applications, is catching up to native C/C++code, Mozilla said.

With Asm.js, developers get a JavaScript subset that can be used as a low-level, efficient target language for compilers. While native C/C++ code still outperforms Asm.js, the performance gap keeps narrowing, Mozilla said in a just-released blog. Asm.js was three times slower than C/C++in February and two times slower around June, but the gap has narrowed to 1.5 times or better. Mozilla has implemented Asm.js in its Emscripten compiler and SpiderMonkey JavaScript engine.

Mozilla attributes performance improvements to float32 optimizations, which offer benefits like fewer CPU cycles since they need less precision, but the company is not yet recommending building with float32 optimizations. “Emscripten disables float32 opts by default, and they are not recommended yet because they rely on Math.fround support in JS engines. Math.fround is part of ES6 (ECMAscript), the upcoming version of JavaScript and is supported in Firefox and Safari but not in other browsers yet,” said Alon Zakai, a research team member at Mozilla. “Emscripten doesn’t want to do something that is faster in one browser but slower in another since it cares about running well in all browsers, so for now it is off by default.”

The Asm.js sublanguage describes a safe virtual machine for “memory-unsafe” languages like C or C++. The Asm.js specification document stipulates that a candidate draft is being developed for a version 1.0 of the specification. SpiderMonkey serves an implementation of the draft. JavaScript is partnered with HTML5 and Cascading Style Sheets as part of Web development. But a recent survey of Appcelerator developer tools users found interest in HTML5 slipping.

This story, “Asm.js JavaScript subset picks up the pace against C/C++,” was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author