An unlikely partnership between rivals may be the key to a much faster experience on the Internet.
After working behind closed doors for months, browser engineers on Wednesday unveiled a project called WebAssembly. The effort, now taking place in public, aims to marry the unbeatable reach of the Web with the speed of software written to run natively on operating systems like Apple’s iOS, Microsoft’s Windows and Google’s Android.
WebAssembly could potentially rebuild the foundations of the computing industry and is the result of the unification of two groups — one from Mozilla’s Firefox team and supported by Microsoft, the other from Google’s Chrome team — that were previously deadlocked on opposite sides of a sometimes fractious debate. The result: an ability to browse the Web much faster, as well as a smoother experience when loading Web apps like Google Photos.
The unification might sound like an arcane matter only coders need care about, but it could prove important to everyone. WebAssembly — wasm for short — is designed to give developers a high-performance alternative to JavaScript, the programming language of today’s Web. By joining forces, programmers can be confident that wasm has a mainstream future. They could write browser-based versions of a new class of software for things like performance-intensive gaming, video editing and virtual reality exploration.
“Having something like WebAssembly would be awesome,” said Yevgeniy Shpika, a co-founder of browser-based photo editing site Pics.io. “It would save at least 20 percent of our budget.”
Cooperative approach
There’s an unusual amount of support behind WebAssembly.
Most new standards on the Web originate with one browser maker or another that must convince other browser makers to support it, typically by rallying developer support. WebAssembly, though, is well on the way toward achieving support from the top four browser makers: Microsoft, Google, Mozilla and Apple.
The near-term promise of WebAssembly is faster Web apps. In the longer run, it could mean the computing industry itself becomes more competitive.
Today, it’s not unusual to run processor-taxing programs as native apps on your tablet, phone or PC — for example, Adobe’s photo-editing software Lightroom. But running a browser-based alternative, such as Pics.io, has its advantages. A programmer, for instance, can write one Web-based app and have it run on any operating system, since you need only the browser.
That programmer liberation could help loosen the grip that Apple and Google have on the technology industry today with their iOS and Android operating systems, where native apps rule. One of the reasons upstart mobile operating systems like BlackBerry OS and Windows Phone have struggled has been because of the lack of native apps. But those challengers and the likes of Amazon or Facebook could rely on Web apps instead.
Rewriting the Web
WebAssembly capitalizes on work from both those formerly dueling camps, Mozilla’s asm.js and Google’s Portable Native Client (PNaCl).
Both Mozilla and Google’s efforts and their combined WebAssembly represent a break from tradition. If you want to write a program for the Web today, you have to employ a 20-year-old language called JavaScript. It’s enabled programmers to move from static documents to dynamic designs like Google Maps that zoom and Facebook timelines that fluidly refresh with new posts. JavaScript programs load with the greatest of ease — all you have to do is open a Web page. That’s a big advantage over jumping through hoops to find, download and install a native software package. JavaScript has been wildly successful.
But JavaScript’s sluggishness has held back the Web. That’s why Google began its Native Client project and, later, the Portable Native Client variation that better spanned the wide variety of computing devices in use today. PNaCl was geared for the large number of programmers who wrote software with the C and C++ languages, letting them convert games and other software so they’d run in a secure compartment within Chrome.
Mozilla didn’t like the idea and responded with asm.js. This approach updates the browser so it can run a low-level subset of JavaScript instructions very fast, and it won support from Microsoft. Asm.js is paired with another Mozilla-launched project called Emscripten that converts C and C++ code into a compatible language.
Now, after years in which neither project gained universal adoption, members of both teams are starting over together.
“I’m happy to report that we at Mozilla have started working with Chromium, Edge and WebKit engineers on creating a new standard, WebAssembly,” said Luke Wagner, one of the project’s leaders, in a blog post Wednesday. Chromium is the open-source foundation of Google’s Chrome, as WebKit is for Apple’s Safari and Edge is Microsoft’s new browser that will succeed Internet Explorer starting with Windows 10.
At its most basic level, WebAssembly provides a different way to let browsers run software written in C, C++, or other languages. To run, they must be translated into the ones and zeros of machine code that a computer actually can act on.
On today’s Web, the browser’s JavaScript translates those instructions into machine code. But with WebAssembly, the programmer does a lot of the work earlier in the process, producing a program that’s in between the two states. That frees the browser from a lot of the hard work of creating the machine code, but it also fulfills the promise of the Web — that software will run on any device with a browser regardless of the underlying hardware details.
The intermediate state also means that programmers can start with whatever language they want, not just JavaScript.
Broad participation
“We think this is the start of an exciting path for having your non-JavaScript source code run quickly and harmoniously with the rest of the Web,” Microsoft’s Mike Holman said in a blog post.
Google programmer Ben Titzer is working on a project to let Chrome’s V8 JavaScript engine decode WebAssembly instructions, too.
And at Apple, WebKit developer Filip Pizlo filed a request to support WebAssembly in Safari. “This standard has broad support, and we should continue to participate in discussions about how to make it great,” Pizlo said.
The father of JavaScript and short-lived Mozilla CEO Brendan Eich might be expected to defend JavaScript against incursions of other languages onto the Web. But he’s a fan, too.
“Having both the PNaCl team and the V8 team from Google, along with key people from Microsoft and the asm.js and Emscripten gurus from Mozilla, collaborating closely once everyone saw the light, has been inspiring,” Eich said in a rare blog post of his own.