Things are constantly changing in the world of computing. From mainframes to cloud IaaS, from virtual machines to Linux, we are constantly extending and reinventing technologies. Often these changes are driven by the fact that “the way we’ve always done it” no longer works in a new paradigm, or actually wasn’t that great to start with.
We don’t have to look hard to see recent examples. Virtual machines (VMs), containers, Kubernetes, and OpenTelemetry are just a few examples where changing requirements inspired new solutions. And as Kubernetes and OpenTelemetry show, when the solution is right a tsunami of adoption follows.
What Is WebAssembly?
Some of you may recall the days of cross‑compilers, where code was targeted at an external environment, often in control hardware. The targets varied wildly, which meant the cross‑compilation had to be strictly aligned between the generating system and the target system. Wasm works in a similar way, providing a binary executable to a defined runtime on a wide range of platforms. Since the runtime is a low‑level virtual machine (think JVM), it can be embedded into a number of host applications.
So Wasm is a portable binary code for executing programs and a set of interfaces for interaction between the program and its environment. No where does it make any web‑specific assumptions, so it can be used widely. In fact, the interest in Wasm is heavily driven by its potential in server‑side use cases. Companies like Cosmonic, Fermyon, and Suborbital are showing that Wasm will impact our future in apps from the browser to the back end.
One of the compelling features driving adoption has been Wasm’s support for many languages, with pretty complete coverage for nearly every popular language, including C, C++, Go, Ruby, and Rust. Partial implementations for other languages are available or likely underway. But a word of caution – Wasm’s support for a given language may be limited to a particular context: the browser, outside the browser, or even directly on a system. So it’s important to verify that Wasm supports a language in the context where you want to use it.
Why Should You Care About WebAssembly?
WebAssembly has focused on several crucial features that all browsers need. We’ve mentioned the polyglot nature of Wasm, which has allowed the browser to be extended to many languages. But there are several others.
- Speed/performance – No one likes waiting for web pages to load. It’s even less fun waiting for a web application to load and start. Wasm’s compilation model makes loading fast. In fact, performance can approach that of a native application.
- Size – For web apps, the size of the objects being downloaded is the crucial factor. Smaller binaries mean faster time to start.
- Cross‑platform – Web browsers are the universal access point for websites and apps, so we want “write once, run anywhere” (on every browser) to be a reality rather than just a promise. Wasm already delivers on this pretty well, and will continue to improve.
- Security – If you have to run untrusted code in your browser, it must be isolated. Wasm achieves isolation with memory‑safe sandboxed execution environments. The current implementation isn’t perfect, but Wasm contributors are heavily focused on it, so I expect rapid improvement.
How Do You Get Started?
There are a lot of great resources on WebAssembly. It is clearly the path a number of companies are following, from startups to major players:
- Adobe has demonstrated Photoshop running in Wasm in the browser.
- Figma saw load time cut by 3X with Wasm.
- Wasm Labs at VMware has demonstrated WordPress, a PHP runtime, and a database all running in the browser.
But you don’t have to start by switching over to Wasm in one fell swoop. These are all great resources for learning more:
- WebAssembly.org is the definitive source for all things Wasm, including the specs and a well‑structured Getting Started guide for developers.
- On her blog, Renee Shah asked technologists at 18 startups how and why they’re using Wasm.
These demo apps are running on Wasm:
WebAssembly is still a work in progress, and as with any new technology, some aspects are more complete than others. Even so, the concepts behind it are compelling, and I predict that it’s going to be a game changer, a major force for the future of adaptive apps, either in browser or in a cloud. Without a doubt, WebAssembly is one of the technologies you need to learn about now.