Big-Four Browser Makers Assembling a Web Binary Format

Edward Correia -
2 MIN READ

Does your JavaScript code take too long to parse and execute? Soon there could be a way to compile that same code into binary, and the people working on it are from the same organizations that develop Chrome, Firefox, Internet Explorer and Safari. That's right. Apple, Google, Microsoft and Mozilla have teamed up to develop WebAssembly, a new binary format that's designed to give the performance-critical portions of a web app a means to execute that's on par with machine-language.


WebAssembly, or wasm for short, is being called a next step for asm.js, which for years has permitted C and other statically-typed languages to act as a drop-in replacement for JavaScript with far better performance. Currently in the experimental stage, wasm will extend the JavaScript engines of Chromium, Edge Firefox and WebKit with a statically-typed version of JavaScript without objects, and will produce binaries that encode abstract syntax trees with statements and expressions. This is unlike the linear format of bytecode, which is register- or stack-based. And like asm.js, wasm will compile languages other than JavaScript and provide a binary format for asm.js bytecode. The spec also will include a text format.


In addition, wasm will provide faster loading times. This is of particular importance for IoT and small mobile devices, and for apps that contain a particularly large code base. This benefit is realized mainly due to the near-elimination of JavaScript parsing. It will be backward compatible with JavaScript of course, but as apps and engines evolve, the days of using ahead-of-time compiling to boost performance could be numbered. For legacy-engine support, a JavaScript library will translate wasm binaries into asm.js bytecode.


WebAssembly is intended to evolve--not replace--JavaScript. It will bring a new set of capabilities, including the ability to make synchronous calls to and from JavaScript and browser APIs with the same permissions and security scheme. It's nice to see the four big browser makers finally rowing in the same direction rather than working on their own PNaCIs or FLTJITs...or doing nothing at all.


profile

Edward Correia

Please Register or Login to post a reply

Replies