WebAssembly Is Now Supported In All Major Browsers

In the summer of 2016, I published an article called Will Anyone Be Writing Javascript In A Couple Of Years? My answer was this: yes, we’ll still be writing Javascript, but over time it may be superseded by other languages that compile to Javascript. Today, of course, Javascript is still everywhere, but, apart from an unfortunate focus on CoffeeScript, I wasn’t completely off in my prediction: many developers write TypeScript rather than plain old Javascript, and Elm, ClojureScript, PureScript, and other languages that compile to Javascript are coming along nicely.

Towards the end of the 2016 article, I speculated that the whole idea of compiling to Javascript may be a dead end because we would eventually use WebAssembly as the compile target rather than Javascript. Obviously, that has not yet come to pass, and I think it’s unlikely that WebAssembly will be the compile target of choice for many years to come. But this December we got one step closer to that being a reality.

WebAssembly is now supported in all major browsers. WebAssembly will run in recent versions of FireFox, Google Chrome, Safari, and Microsoft Edge.

The goal of WebAssembly is to allow developers to run large complex applications on the web without plugins. A common use case is games: many game developers want their games to run in the browser, but they don’t want to build enormously complex games in Javascript. They prefer C++ and other statically typed languages. Additionally, loading, parsing, and executing a Javascript version of a game engine would not provide a positive experience.

WebAssembly (wasm) is intended to solve those problems. WebAssembly is a bytecode that browsers can run with performance only marginally slower than native code. WebAssemby is fast to transmit across the web, fast to load, and fast to run. Today, developers can write applications in languages like C++ and Rust, compile it to WebAssembly, and run it in browsers.

Earlier in 2017, Unity, a hugely popular game engine added experimental support for WebAssembly. If you’re running a recent browser, take a look at Tanks, a Unity demo running on WebAssembly in the browser.

But games are not the only applications that stand to benefit from WebAssembly. As one of the team behind WebAssembly, Luke Wagner, points out in a fascinating article that explores the history of its development, asm.js, WebAssembler’s ancestor, is widely used today:

“Facebook, for example, now uses asm.js to compress users’ images in the browser before upload, saving bandwidth. Adobe compiled a core image-editing library written in C++ to asm.js for the Web version of Lightroom. And Wikipedia uses asm.js to play video formats when the browser doesn’t provide built-in support.”

WebAssembly is useful for compute intensive applications that would once have required native code running on bare metal, rather than transmitted over the web and run in a browser — that used to mean plugins and browser manufacturers are not fond of plugins because they can’t control the experience or the security of plugins (see Flash).

Now that WebAssembly is available in all major browsers, we can expect to see its gradual adoption for games, machine learning applications, computer vision, encryption, compression, and other areas where native computational performance is required.

Dedicated Server Special

Take advantage of our Double RAM offer on the E3-1230v2 4 x 3.30GHz+HT server! Only $134.95 per month. Managed and Unmanaged options available at checkout.

GET STARTED