If you’re reading this there is a good chance that you work in the software development industry in some capacity. Maybe you have heard the term “WebAssembly” over the past few years or simply curious to learn something new. Either way, the goal of this post is to provide an overview of what WebAssembly is, who’s behind it and using it today, and how they (and possibly you) use it to build software applications.
What Is WebAssembly (WASM)?
“WebAssembly (abbreviated WASM) is a binary instruction format for a stack-based virtual machine. WASM is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications,” per webassembly.org.
The big take away from this is the “compilation target for programming languages.” I highlight this because you may be under the impression that you write WASM code, but in reality you compile your code into WASM binaries. As it states “WASM is a binary instruction file which can run in a stack-based virtual machine.” In other words, a binary file that runs in an abstraction of a computer that acts like real hardware. The goal of WASM is for that abstraction to exist in the browser seamlessly.
Who Is Behind WebAssembly?
The Web Assembly Working Group, a part of the World Wide Web Consortium (W3C), with contributors from the major players in modern web browsers, including Mozilla, Microsoft, Google and more, is responsible for WebAssembly. In 2019 W3C WebAssembly became the fourth language for the web which allows code to run in the browser, a huge stamp of approval by the people that are building the browsers where your applications will run. This should give you confidence that this is not another fly-by-night technology when considering WebAssembly as a solution for you, your customers, and your business.
Who’s using it?
At madewithwebassembly.com you can see a list of projects that use WebAssembly. It’s a wide ranging list but here are some of the interesting highlights:
- Autocad, one of the oldest computer drafting software’s was able to make a web version of their application using WebAssembly.
- Unity, a gaming engine with a web player made using WebAssembly providing a performant 2D and 3D gaming that would otherwise not be possible.
- GoogleEarth, C/C++ codebases for native applications were ported to the web for performant 3D graphics in the browser.
- Blazor, one of Microsoft’s newest programming frameworks allows you to write C# code that compiles into WebAssembly that executes client side.
These examples hold a common thread, each projects is dependent on performant code running in the browser using WebAssembly.
How does it work?
Why would you use it?
There are a few regular use cases for going to WebAssembly as a solution.
Bottlenecks in your application
Areas in your application that a 50% increase in execution time or more consistent execution time would drastically improve the end users experience. Maybe your application has some backend business logic and you want to eliminate the server usage and the time it takes to communicate with it by executing that logic directly on the client. WebAssembly would be a solution.
Filing a technology gap
Making use of non-web friendly code
“Sqoosh” is also a good example of making use of non-web friendly code, it uses multiple libraries written in a variety of languages compiled into WASM to deliver a wide range of image processing functionality. The idea is, code exists already that does something you want to do on the web, maybe WASM can be the solution that brings that code to the web.
The code for this video can be found on github at https://github.com/rmroot/WebAssemblyLnL if you want to take a look at it yourself.
Here’s where I give you my opinion on WebAssembly. I have worked with it on and off over the last couple years to bring a C++ library to the web. It’s been a fascinating experience and WebAssembly was the only technology out there that would allow us to execute the C++ library on the client like we needed to. It’s been smooth but tedious sailing writing the bindings and integrating them into the web application. The hiccups only showed up when the C++ code got a little complex for a web developer in a C++ world. I’d say my first hand experience as a developer working with WebAssembly overall has been good! I’d say my experience as a user of an application built on WebAssembly has been great! The performance kick isn’t hype, as the demo shows, you’re able to run the same logic at a 50% speed increase. In some spots that is going to make or break an application’s success.
Founded in 1991, Intertech delivers software development consulting to Fortune 500, Government, and Leading Technology institutions, along with real-world based corporate education services. Whether you are a company looking to partner with a team of technology leaders who provide solutions, mentor staff and add true business value, or a developer interested in working for a company that invests in its employees, we’d like to meet you. Learn more about Intertech, Inc.