Google Proposes New Features for WebAssembly

This week at Google I/O, Software Engineer Deepti Gandluri presented a session titled “WebAssembly for Developers.” In this session she presented new features for WebAssembly which have already been implemented in the current version of the Chrome Web browser. The proposed new features are WebAssembly Threads, SIMD, Implicit Caching and ReferenceTypes.

WebAssembly Threads

WebAssembly Threads extend the capabilities of the current browser-based Web worker thread architecture. As Gandluri said during her presentation, “The dark side of Web workers is that they do not share data between them.”
WebAssembly Threads, on the other hand, allow threads to access shared memory. The result is that now Web developers can write code that, for example, allows independent threads to concurrently render images across the main web page. Without the capabilities provided by WebAssembly Threads, threads need to “wait in line” to do the rendering. The performance gains can be significant.

SIMD

Single Instruction Multiple Data (SIMD) allows a single instruction executed on a CPU to operate on multiple data instances, thus making overall execution time 2 to 5 times faster. SIMD is particularly useful for tasks such as in-browser video processing which typically requires massive amounts of CPU resources to do work.

Implicit Caching

Implicit Caching speeds up the time required to get WebAssembly code up and running in a browser. Using Implicit Caching, the WebAssembly binary gets recompiled on the browser to a CPU specific format once and then cached for repeated use. Before the introduction of Implicit Caching, recompilation of WebAssembly binaries happened repeated.

Reference Types

Reference Types provide the ability for WebAssembly code to directly access browser-based APIs previously available only by interoperating with JavaScript. For example, prior to the introduction of Reference Types, if WebAssembly code needed to determine the label text of a particular button in a Web page, it had to call a JavaScript function to get a list of elements in the Web page's DOM. Now, with Reference Types, WebAssembly code can directly reference these DOM objects. Also, Reference Types are the first step toward making WebIDL a standard for browser-based programming. The purpose of WebIDL is to a standard way for languages to use browser resources directly.

Google’s Vision for Web Assembly

According to Thomas Nattestad (Product Manager at Google), the new features are central to Google’s intention of positioning WebAssembly to increase performance and portability in the browser and enhance the power of browser-based computing to enable initiatives such of Progress Web Applications and new Web Capabilities. According to Nattestad, “If you can build in iOS, Windows, or IoT, you can build it in a browser.”

 

Comments (0)