Web Assembly in Action
Its crazy to think that an idea can go from a mock book cover to an international standard.
With the introduction of WebAssembly we have truly game changing technology on our hands.
WASM is a cross platform IR/assembly language that higher level languages can target.
It was announced in 2015 and was first supported by all browsers as a minimum viable product in 2017.
Since then the tooling and support around it has improved drastically.
It's biggest selling point is that it allows legacy code to be easily ported to run on the web.
Many companies have started experimenting with the technology to create new and improved web applications.
Some of the Uses
-
AutoCAD: A 35-year-old codebase successfully ported to the web using WASM.
-
TensorFlow.js: Originally written before WASM existed, requiring a full rewrite to run in browsers. A WASM backend was recently added, enabling code sharing and major performance boosts.
-
Uno Platform: Build for iOS, Android, Windows, and the Web from a single C# + XAML codebase.
-
Windows Calculator App: A great example of Uno in action: Try it here.
-
DOOM 3: Ported by a single developer in their spare time: Play it here.
-
Major UI/Engine Support: Qt, Unreal Engine, and Unity all have WASM support.
My experience
WASM has provided more free reign in how I develop applications.
Two of my favourite languages Rust and C++ have some of the best support allowing me to use them on any platform.
Although no where near performant as native code you still get some of the benefits like threading support through web workers and SIMD which helps it perform better than JS.
Cross Platform Image Processing
I'm currently working on an application that allows you to interactively work with and get insights from images from any device.
I'm using OpenCV as a static WASM library that I build daily using the following docker image OpenCV Static WASM Library Docker.
As part of my build system I can compile my code to both WASM and whatever native platform I'm using (Linux, macOS, Windows).
Without WASM this application would not be feasible.
Challenges
A recent study showed that "56%, the majority of all WebAssembly usage in the Alexa Top 1 million is for malicious purposes".
Let's work to change that statistic.