On “On Asm.js”

Nov 27th, 2013

On his impossibly beautiful blog (seriously, it’s amazing, take some time to bask in it), Steven Wittens expressed some sadness about asm.js. It’s an understandable feeling: he compares asm.js to compatibility hacks like UTF-8 and x86, and longs for the browser vendors to “sit down and define the most basic glue that binds their platforms”—referring to a computational baseline that could form a robust and portable VM for the web.

I get it: it’s surprising to see a makeshift VM find its way into the web via JavaScript, rather than through the perhaps more direct approach of a new bytecode language and standardization effort. What’s more, it has become clear to me that emotions always run high when it comes to JavaScript. It’s easy for observers to suspect that what we’re doing is the result of a blind fealty to JavaScript. But the fact is, our strategy has nothing to do with the success of JavaScript. It’s about the success of the web. On a shared medium like the web, where content has to run across all OSes, platforms, and browsers, backwards-compatible strategies are far more likely to succeed than discrete jumps. In short, we’re betting on evolution because it works: UTF-8 and x86 may be ugly hacks, but the reason we’re talking about them at all is that they’re success stories.

There’s more work to be done, but between sweetdemos, rapid improvements in browser performance, and the narrowing gap to native via float32 and SIMD, I see plenty of reason to keep betting on evolution. The truth is, in my heart I’m an idealist. I love beautiful, clean designs done right from scratch. (I spent my academic years working in Scheme, after all!) But my head tells me that this is the right bet. In fact, I’ve spent my career at Mozilla betting on evolution: growing JavaScript with modules and classes, leveling up the internal architecture of browser engines with Servo, and kicking the web’s virtualization powers into high gear with asm.js.

So for developers like Steven who are put off by the web’s idiosyncratic twists of fate, let’s keep working to build better abstractions to extend the web forward. In particular, in 2014 I want to invest in LLJS, as James Long has been doing in his spare time, to build better developer tools for generating high-performance code—and asm.js can be our stepping stone to get there.