If you are a tech person, chances are that you’ve already come across the concept of having an assembly-like language for web pages. WebAssembly, or Wasm for short, is a relatively new low-level instruction format that can execute for the Web at near-native speed.
Far from being the first attempt on such goal, since asm.js and others, Wasm has attracted the most hype and gained a lot of traction, being supported by all modern browsers thanks to the joint effort of the World Wide Web Consortium (W3C) and also Mozilla, Microsoft, Google and Apple. You can see it in action not only in a lot of demos, from little games to stunning 3D scenarios, but also in real-world large projects from companies like Autodesk, who leveraged Wasm to release AutoCAD as a web app, and also Figma, who cut their app load time by 3x just by switching to the new standard. Those are some impressive concrete results that showcase the impact of the technology.
So, how does one write WebAssembly? Although it does have a human-readable representation, Wasm is just binary code, so you’ll usually compile other languages to it — and that’s where it gets interesting. There is solid support for C++ and Rust and there are also compilers, albeit with varying degrees of readiness, for a host of other languages like Lua, OCaml, Kotlin, Go, etc and also new languages made specifically for the new standard, like the TypeScript-esque TurboScript. That means that sooner or later you’ll be able to compile to Wasm using your preferred language or the one your team is the most proficient at, for instance.
To get started with WebAssembly, basically you have two paths: if you’re familiar with C++, you can get the Emscripten SDK; the other alternative, if you want to try a more modern language instead, is Rust — in that case, you’ll need rust-wasm. Both toolchains have all the tools you need to run your first piece of WebAssembly and vexcellent tutorials to guide you on that — go ahead and try one!
About the author
Pedro Fialho is a Software Engineer at Poatek. He is passionate about code, music and other arts and crafts.