This article is more than 1 year old

WebAssembly: Finally something everyone agrees on – websites running C/C++ code

Native code spec gets buy-in from major browser makers

Google, Microsoft, and Mozilla on Monday announced preview versions of WebAssembly, a low-level safe binary format designed to allow C/C++ code to run in web browsers.

Once WebAssembly, or wasm, matures and appears in browsers, it will allow developers to create native applications, and web applications with native code libraries, that run in browsers to deliver computationally complex content like streaming video, video editing, games, and virtual reality at high frame rates.

Those backing WebAssembly claim the technology runs ~20x faster than JavaScript. Mozilla says its tests show WebAssembly running only 1.13 times slower than native speed.

Similar efforts to make browsers better at handling native application code have been undertaken before, such as Google's Native Client technology and Mozilla's asm.js, a reduced set of JavaScript instructions tuned for speed. But these approaches haven't had broad support from all the major browser makers.

WebAssembly, on the other hand, is driven by the W3C WebAssembly Community Group, and is backed not only by Google, Microsoft, and Mozilla, but by Apple.

Also, asm.js has some technical shortcomings like lack of SIMD (single instruction, multiple data) support to accelerate parallel processing.

In a blog post last year introducing the technology, JavaScript creator Brendan Eich explained that while asm.js is great, it puts too much pressure on the JavaScript parser in mobile devices.

"Transport compression is required and saves bandwidth, but decompression before parsing hurts," Eich said, while citing other issues.

The WebAssembly Browser Preview is hidden at the moment. It's behind a flag in Google's V8 JavaScript engine and in Mozilla's SpiderMonkey. In Microsoft's case, it's only in internal development builds of the company's Chakra JavaScript engine. And while Apple did not join in the group announcement, Google reports that WebAssembly support is under development in WebKit's JavaScriptCore.

Google and Mozilla are offering preview versions of WebAssembly to solicit feedback from developers on the design and implementation of the specification.

The WebAssembly Community Group intends to publish an official specification in Q1 2017, after which WebAssembly is expected to start appearing in browsers. Mozilla said it plans to ship WebAssembly in Firefox 52 around March 2017. ®

More about

TIP US OFF

Send us news


Other stories you might like