Last week I'd organized a small briefing at work about WebAssembly. The goal of the briefing was to give my colleagues an overview about what WebAssembly is and how it can be used to improve our products.
I've used these notes for the discussion.
What should have been already known
The list of the languages that compile to WebAssembly is getting bigger and bigger. But does it support
_.sample(popularLanguages)? Most probably: yes, it does. Someone already made a language designed for WebAssembly called Assembly script.
It is heavily inspired by Typescript, and it targets web developers that don't want to learn a new language.
Motivation behind WebAssembly
WebAssembly is a safe, portable, low-level code format designed for efficient execution and compact representation. Its main goal is to enable high performance applications on the Web, but it does not make any Web-specific assumptions or provide Web-specific features, so it can be employed in other environments as well.
As the WebAssembly programs are compiled into portable binary-code format, they are fast to transfer over the wire and also parse by clients.
Use of such technology allows new types of programs to be ran inside the web browser, such as:
- Image / Video editors
- AAA Games
- ML / AI-powered applications
- Scientific visualizations and simulations
- Live video augmentation
- Language interpreters and VMs
- CAD applications
- Compiling is done via Emscripten, which is still used as of today to port C applications to WASM.
- 2015 - WebAssembly announced with a feature set of asm.js
- 2017 - Initial MVP API designed and agreed upon in between 4 major browser vendors
- 2018 - Core specification released
Current version of the API is 1.1. It is intended that it will be superseded by new incremental releases with additional features in the future.
Here is a list of latest standartized features which are being implemented in browsers: Roadmap
List of applications making use of WebAssembly
- Google Earth
- Photon Image processing
- Baldur's Gate II
- Doom 3
- Flash virtualization
- ebay using WASM for barcode scanning
- Dropbox compression algorithm
What it could be used for
- Cross platform application development
- Hardware made directly for consuming WebAssembly instructions
- If WASM is emergint to become the standard format for executables, tailor-made hardware chips migth become more efficient in the future. No more competing architectures.
- Transformation of the web to more efficient platform would have ecological impact on the environment. If the bundles are smaller and easier to parse that means it will significantly lower need for resources (less power consumption, cheaper hardware).
Web application frameworks
Yew is a modern Rust framework for creating multi-threaded front-end web apps with WebAssembly.
- Features a macro for declaring interactive HTML with Rust expressions. Developers who have experience using JSX in React should feel quite at home when using Yew.
- Achieves high performance by minimizing DOM API calls for each page render and by making it easy to offload processing to background web workers.
- github repository
- Sample app
Really simple framework for Golang Github
Discussions lasted for few days. I am really excited about the feedback I've received. I'll definitely organize something similar in the near future.