WebAssembly — Then, Now and Ahead
WebAssembly is an emerging standard to enable near-native performance for web applications. As the name itself suggests, it’s an assembly language for the web, a low-level compile target. It’s an attempt to bring new low level primitives to the web.
How it started Then
“Who we are cannot be separated from where we’re from.” ― Malcolm Gladwell, Outliers: The Story of Success
WebAssembly was first announced on 17 June 2015 and since then it’s been getting ever increasing attention, with major browsers — Chrome, Edge, Firefox, and Safari, reaching consensus on the design of the initial MVP, in March 2017.
asm.js, applications running in the browser can achieve performance that’s comparable with that of native code.
But the people clamoring for a bytecode for the browser never went away, and they were never entirely wrong about the perceived advantages. And now they’re going to get their wish. WebAssembly is a new project being worked on by people from Mozilla, Microsoft, Google, and Apple, to produce a bytecode for the Web.
Below picture depicts how it’s been getting so far.
Where it stands Now
WebAssembly will include both a binary notation, that compilers will produce, and a corresponding text notation, suitable for display in debuggers or development environments. Early prototypes are already showing some of the expected advantages; the binary representation is 20 times faster to parse than the equivalent asm.js.
For WebAssembly to succeed we need two things:
- Browsers to support WebAssembly natively
- Compilers that emit WebAssembly
There is work being done on other languages to be compiled to WebAssembly like Rust and Swift. Steve Sanderson also has an experimental project called Blazor that shows .Net being compiled to WebAssembly.
We may see a resurgence in small C libraries targeting WebAssembly. There is a growing trend of header-only libraries, especially the popular stb(https://github.com/nothings/stb#stb_libs) and there is a growing list here. There are tiny libraries appropriate for linking into a web based C application e.g. lodepng, for decoding PNG images, and miniz, for reading and extracting zip files. There is an enormous amount of code out there in C, C++ and other languages that people would love to use in web apps. Productivity apps such as Photoshop and CAD can be ported. They are an enormous part of the software industry and the browser is a great platform for distribution for many cases. Performance and code secrecy being two barriers that WebAssembly solves for them.
I have seen the future, it’s in my browser.
Further the WebAssembly community group and contributors have plans to:
- Distill the design and spec interpreter repos into a single unified specification in the spec repo
- Propose a new charter for a W3C WebAssembly Working Group
- Graduate the WebAssembly LLVM backend from experimental to stable (and update Emscripten)
- Prototype additional WebAssembly integration into browser developer tools
- Start work on post-MVP features
Originally published at chandanrai.com on June 9, 2017.