What is WebAssembly
WebAssembly, or "wasm", as it is also known, is a low-level language available directly in the browser that can serve as a compilation target for any traditional high-level compiled language, such as C, C++ and Rust. With introduction of Blazor, even .NET languages can now be compiled into WebAssembly. So, as the name suggests, the language plays a similar role to the traditional Assembly language, but it is specifically designed for the web.
WebAssembly is not a proprietary technology owned by a single organisation. It is an emerging web standard that is currently being finalised. As such, it is available in any modern browser that is being actively updated. As the technology is a web standard, it is not susceptible to the same fate as Flash, Java Applets or Silverlight. WebAssembly is here to stay.
What are can WebAssembly do
- Augmented reality
- Image recognition
- Computer-aided design
- Modelling complex systems
For the full list of wasm use cases, you can visit this page.
How WebAssembly works
WebAssembly has a chunk of memory specifically allocated to it in a form of a resizeable ArrayBuffer. Anything that cannot be stored in the ArrayBuffer for portability and safety reasons is stored in specially dedicated table.
On it's own, wasm module is stateless, but it can keep the state by working in conjunction with the dedicated chunk of memory and the table. When taken together, these components are known as "instance".
The language itself is not dissimilar from the Assembly language used in installed applications. The language is still being finalised, but the most of it has already been sufficiently developed to build powerful software. For those who are interested how the instructions are structured, this guide will help.
Written by Fiodar Sazanavets
Posted on 3 May 2018