What is WASM?
Here is an example of the execution flow of a C/C++ application in your browser.
Why do we need WASM?
Web development has long been known for its never-ending cycle of
What is the best new tool to use?
That is about to get a whole lot more complicated with the introduction of WASM and the influx of new languages and tools accessible to web developers. Potentially, this influx could take a different approach in the direction that the web is going.
WASM is based on an open standard, meaning all browsers will have to comply with the same rules. So waiting for browser vendors to upgrade their standards at different paces could be a thing of the past.
The biggest benefit of WASM is performance and how this will affect mobile browsers.
For example, games that are currently on your phone and desktop can now be run in your browser without platform-specific limitations thanks to the WebGL shaders.
This is not a new feature, but with the performance of WASM behind WebGL as well as the myriad of languages that can be compiled into WASM, we could see more games being developed solely for the web. Not to mention, the benefits of it being cross-platform.
Below, is a quick example of the performance benefits of WASM vs JS on a OnePlus 3 & MacBook Pro 2015 model
This suggests benefits in performance, but image processing on desktop is still lacking.
What are the advantages for developers?
For seasoned developers new to the web this is great, as there might already be tools in languages they know for building web applications. For web developers, this is a great opportunity to try out new languages and frameworks.
Blazor is an example of how .NET developers can already start taking advantage of WASM and build applications for the web.
Blazor is an experimental web framework developed by Microsoft. At first glance it seems great, it has all the features of a frontend framework with the ability to use Visual Studio as an IDE.
WASM also allows code-sharing between more languages, so if you already have a .NET backend, using Blazor for the frontend would be quite beneficial.
These tools are all in early phases though, so using them in production is probably not a good idea just yet.
Will this affect the mobile app market?
For a limited amount of use cases, WASM could definitely interrupt the app market. With the performance benefits behind it, we could see web versions of mobile apps run at very similar speeds.
But with the need for an internet connection, there is certainly a limited amount of cases that WASM would be more beneficial in using.
One of the first questions asked when choosing a new tool for the web is browser compatibility, and how this affects the audience you are targeting. WASM is currently supported by 78% of global users as shown below
Which in reality, is not that good. Fallbacks can be implemented for older versions of Chrome using asm.js, but there is still the constant issue of Internet Explorer. So if your audience is likely to use IE, then WASM might not be for you.
WASM is great, although it might not be the time to jump into it straight away. With the limited support for the global browser market share and the fact that most frameworks built for WASM are in early days, we still have a bit to go before WASM becomes the norm.
When that day comes though, the web will be a different place, and the community behind it too. Developers from all areas will have greater accessibility in contributing to web applications and the use cases for the web will expand even more.
If you'd like to read further on this there are some great resources out there. Check out these links:
https://github.com/aspnet/blazor - .NET web framework using C#/Razor and HTML
https://github.com/mbasso/asm-dom - WASM virtual DOM to build C++ SPA
https://webassembly.org/demo/Tanks/ - Unreal Engine 4 to WASM Demo
https://takahirox.github.io/WebAssembly-benchmark/ - Performance Benchmarks
Front End Developer