Skip to content
Descriptive alternative text

WebAssembly - a web performance revolution?

An evaluation of the current state of WebAssemblys performance, potential use cases, usage and remaining limitations. A paper I produced as part of the lecture Entwicklung von Rich Media Systemen at HDM Stuttgart.

Table of Contents

Open Table of Contents

Limitations of the traditional web platform

JavaScript is powerful enough to solve the majority of tasks on the web, but the traditional web platform has run into performance problems with more intensive tasks like 3D games, virtual and augmented reality, computer vision, image and video editing. These use cases often demand native level performance that JavaScript simply cannot provide. Another problem with JavaScript is the cost of downloading, parsing and compiling very large applications, especially on resource-constraint platforms that can quickly lead to performance bottlenecks.

An Introduction to WebAssembly

WebAssembly (WASM) is a low level language similar to assembly with a compact binary format that can be run in modern web browsers. It promises to enable applications to run with near-native performance on the web. Although being a human-editable text-format, WebAssembly serves primarily as a compilation target for languages such as C/C++, C# and Rust. It takes advantage of common hardware capabilities available on a wide range of platforms, including even mobile and IoT devices. It is designed to work alongside JavaScript by allowing synchronous calls to and from JavaScript, implementing the same-origin and permissions security policies and by using the same WebAPIs that are accessible to JavaScript.

Use Cases

Google Earth

Load time comparison of figma documents

One well-known example of porting an existing desktop application to the web platform with WebAssembly is Google Earth. Originally most of the existing Google Earth desktop application was written in C++. When WebAssembly was introduced it opened up the opportunity to use the same code and run it on the web across different browsers, which was previously not possible.

Figma

Figma is a collaborative web application for interface design. Similar to Unity, Figma used asm.js ahead of the arrival of WebAssembly. It is written in C++ and can therefore be compiled easily into WebAssembly. Figma achieved some notable improvements in terms of load time with WebAssembly, as you can see in the following chart:

Load time comparison of figma documents

The chart shows that the load time improved by more than 3x independent of the document size. Additionally some minor improvements in terms of the download size of the compressed code could be achieved with WebAssembly.

Paper

If you want to read more about WebAssembly and my final verdict on whether it truly lives up to the promise of delivering native performance on the web, consider reading the paper: Download


Previous Post
Using Wordpress as a headless CMS for a React page
Next Post
Event processing and video upload in a ultra large scale video platform