What’s new with WebAssembly portable code

The JavaScript companion for faster web applications is likely to gain more language support and more browser optimizations

Holding the promise of faster web applications, the WebAssembly portable code format is moving beyond its initial implementation, with its backers at the World Wide Web Consortium, ready to fit WebAssembly with more language accommodations and performance improvements.

WebAssembly, introduced with great fanfare in 2015, is a low-level format intended to exceed JavaScript’s performance when it comes to executing computationally intensive operations in a browser. WebAssembly provides a binary code format that is smaller over the wire, loads faster, and has better performance than JavaScript. It could prove useful in applications such as web-based CAD programs, 3D models, calculators, and games.

Browser vendors back WebAssembly

Support for WebAssembly in browsers is critical. And all four major browser vendors—Apple, Google, Microsoft, and Mozilla—have been on board with WebAssembly.

There is now broad agreement within the W3C WebAssembly group on the initial version’s draft, said Luke Wagner, a Mozilla engineer on the WebAssembly team. WebAssembly reached MVP (minimum viable product) status in March. Implementations are shipping in the Firefox and Chrome browsers. Microsoft supports the WebAssembly MVP with the Insider program’s beta builds of Edge without a flag. The browser engine in Apple’s Safari, WebKit, provided a full implementation of WebAssembly in June.

Already, a 3D library called Dracohas been released by Google that uses WebAssembly. Used for compressing and decompressing 3D geometric meshes and clouds, Draco features a WebAssembly decoder for better performance.

WebAssembly can beused with JavaScript in applications, with JavaScript used for scripting and WebAssembly for computational performance. WebAssembly JavaScript APIs can load WebAssembly modules into a JavaScript app. “You can use them both and call back and forth between them,” Wagner said.

WebAssembly will gain more language support

A key goal of WebAssembly is enabling code written in languages besides JavaScript to run in the browser. The technology serves as a compile target for other languages. Right now, C++ is the preferred language for use with WebAssembly.

It is technically possible now to use other languages with WebAssembly, and there have been experimental implementations to work with the format. However, these languages cannot currently achieve the ideal performance, memory utilization, or DOM integration, Wagner said.

As a result, WebAssembly will likely be enhanced to support languages using higher level garbage collection, such as Java, C#, and Python. “We’ve been discussing adding direct support for WebAssemby in a way that plugs into the garbage collector that’s already in the browser,” Wagner said. This could enable a new wave of applications using WebAssembly. But it could take a couple years to accomplish this.

Managed languages such as Java require extra additions to WebAssembly that are being worked on, said Alex Komoroske, group product manager for the web platform at Google.

Other enhancements being considered for WebAssembly include:

  • Shared memory and multithreading. This is probably the top request from C++ users, Wagner said. A proposal is making the rounds and is be finalized by 2018.
  • Internal optimizations among browsers
  • Exception handling and SIMD capabilities, to enable compiled code to run faster.

Join the newsletter!

Error: Please check your email address.

More about AppleGoogleMicrosoftMozillaMVPW3CWorld Wide Web Consortium

Show Comments

Market Place

[]