My Thoughts On WebAssembly

Just this past week, I was happy to announce that I finally completed something I’d been working on since November of last year – A WebAssembly Video Course. It was challenging for sure – I had played around with WebAssembly, but this was the first time that I was building a course from scratch and then recording it. You learn so much about a technology by teaching it, and I got to explore new depths of WebAssembly throughout this course. I’d like to share some of my thoughts of the WebAssembly/C++ ecosystem.

The Good

Getting Started With WebAssembly/C++

Using Emscripten was incredibly easy. It’s felt just like a clang or gcc (it’d better, it’s a wrapper around llvm). To take an existing C++ project, and convert it to using Emscripten was trivial. Almost everything just about worked. Emscripten automatically provides a HTML and JavaScript file to see your project, if you want to, and that made quick iteration a cinch. If you want to play with C++ and WebAssembly, go try it out right now.

Bonus points for Emscripten tests as well.  Tests should act as documentation (but not your only kind), especially for examples. Emscripten gave so many different tests that I could load on my own and play with. It gave a safe space to experiment, which is crucial to playing with new technologies.

The Documentation

Go look at and In my opinion, their documentation is fantastic in explaining things succinctly, and providing solid examples in the code.  I hate poor documentation, and it’s beyond frustrating learning a new technology when things aren’t clear/don’t work.

Case in point, one time I was learning Forth, and trying to figure out file I/O. I found some documentation, and copy pasted it into my editor, and it wouldn’t even compile. I’m sure I was doing something wrong, but I had no idea what, and it left a bad taste in my mouth.

Going through the WebAssembly and Emscripten docs, on the other hand, were pleasant, and I actively enjoyed browsing different topics, which is a big win for explorability of your tool.

The Bad


The web ecosystem for debugging/profiling/tracing is superb, there’s no denying that. There’s a wealth of tools that most people don’t even know about built right into your web browser (memory snapshotting, network tracing, cpu profiling, storage introspection, etc.). These were all incredible features, but in the context of WebAssembly, they have a little bit more to grow. In order to effectively inspect variables, I had to look at both Firefox and Chrome simultaneously. It will get there, it just feels a bit immature at the moment.

Advanced C++ Features

Porting C++ to Emscripten is not instant, especially as your project uses more complex behaviors. Threading requires extra effort, especially if you are blocking the main thread (JavaScript does not like the main thread being blocked). File system requests may require a little of setup in the JavaScript code to get devices mounted. Network requests are typically done asynchronously, which may not be how your code is set up.

The Ugly

Graphics and Audio

This isn’t a dig on WebAssembly, but the state of graphics and audio in C++. I do not find graphics/audio programming to be accessible. Emscripten documentation recommends using SDL, or OpenGL, or OpenAL, and while these are super powerful, they are not beginner friendly. I could see this being especially frustrating for someone building their own games or simulations without a strong background in these technologies. I feel like these libraries are so performance-intensive (and to some degree, they need to be to run the heavy hitters), that they sacrifice usability. I’d like to see more examples in the community that use simplified APIs and paradigms, even if it does cost some performance. You have to be able to build something and learn about it first, and then you can worry about optimization.



So those are my thoughts.  Agree/Disagree?  Let me know in the comments below.  Feel free to share what you’ve liked/disliked about the WebAssembly ecosystem as well.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s