When I talk about WASM, I get mixed responses. Sometimes I get, “Wow, that sounds revolutionary,” but mostly I just get blank stares and a shrug like they don’t care. Perhaps they’re thinking, “Oh great. Another thing to learn or I’ll get left behind!” That’s how it seems anyway. But I get it—there’s already a ton of technologies that have come out just in the past couple years, so it’s easy to understand why some might just pass WASM off as just one more thing to learn. But it not JUST another thing to learn. It’s a binary format and it’s about to change the web forever!
Dude… What’s WASM?
Who’s it For?
First let me talk about the cool stuff. Some people are going to make games with it! The top two game engines, Unreal and Unity, can already export to web using WebAssembly. So if you’ve always wanted to make super graphic intense web games, then the future is now! Personally, I’ve dabbled in game development, but I’m not really a game developer; however, I’m eager to see the disruptive advancements that are coming our way.
As for us web devs, we might not even use WASM directly, but, at the very least, we’ll use it passively through libraries and frameworks like React and, most likely, webpack. There’s no official word that these frameworks will utilize WASM that I know of, but there’s been some speculation that the React team might soon use it to speed up React’s virtual DOM, which is a huge resource hog, so it could use as much optimization as it can get.
TypeScript to the Rescue
If you’re thinking, “But I don’t wanna write websites with C++,” then don’t worry. I’m right there with you! Lucky for us, there’s a project called AssemblyScript that I only just learned about while writing this blog, conveniently enough. AssemblyScript simply extends TypeScript with WASM specific types like i32 and i64 (integers) and will automatically codesplit into JS and WASM files, so you don’t have to get into the nitty gritty of things. Magnificent!
A team at Google has already used AssemblyScript to build a web-based image compression tool called Squoosh. With it, you can compress images in real-time completely in browser. For more information on it, the developers give a good talk about it and also there’s a YouTube video where they explain why WASM was crucial for optimization of the app. They say it kind of had to do with a certain browser that doesn’t run on Mac. 😉
A potential downside is that WASM is still very cutting edge. It’s basically the wild west, so learning resources are sparse. It’s getting there, but you still might have to do some experimentation and invent your own standards and practices. Good news is that if you strike while the iron’s hot, you might make a name for yourself as a WASM pioneer.
Whether you think you need it or not, you have to admit, WASM is pretty awesome! Undoubtedly, it’s something to look forward to and get excited about. The web may change a little, but it’s nothing to fear. WebAssembly may finally bridge the gap between web and native, which is the part that gets me the most giddy. But all in all, things are going to stay mostly the same; however, now we have a shiny new tool for when we need some extra power.