
The desktop Graphical User Interface (GUI) has been with us since the 1990s, when Windows became mainstream. Out went character-based screens, replaced by icons and multiple fonts, selectable via mouse. Around this time, the Web went mainstream. Unlike Windows and other desktop GUIs, however, the Web user experience was generally poor. Web GUIs had the odd popup window, lots of graphics and colored 3D buttons, and animated cursors… if you were lucky. At least in the beginning, websites were designed for displaying information, not sophisticated input. (It didn’t help that, until 2000, producing nice-looking webpages required a lot of effort. You put controls, text and pictures into tables to give the page some structure. As browsers adopted new CSS standards, it became easier to have a website both look good and not vary in appearance between different browsers.) If you want to create complex—and perhaps good-looking—GUI pop-up windows in your browser, your first choice of tool might be JavaScript. There are few alternatives; Adobe Flash is now history, of course, thanks to its failure to transition to mobile (not to mention the extensive security concerns related to plugins). But JavaScript is a bit of an arms race, with the potential to confuse developers: You have a choice of environments and frameworks such as Node.js, Meteor.js, React.js, Ember, and so on. There is an alternative: WebAssembly, described by some as Adobe Flash without the plugins. A web standard that focuses on speed, it is meant to complement JavaScript, while also allowing web-based development in other languages. WebAssembly isn’t the first attempt at speeding up web processes. Earlier experiments such as Google Native Client (no longer active) also did this; code written in C/C++ ran in a sandbox, isolated from the operating system. But that’s been discontinued in favor of WebAssembly. Back in ye olden days of 2012, there was asm.js, a subset of JavaScript optimized for speed; it was successful up to a point, making it possible to convert C/C++ programs into asm.js that ran with notable speed improvements. Downloading and parsing asm.js applications, however, remained slow. Producing WebAssembly is a two-part process on Windows, Linux or Mac; it involves compiling the application source, then running Emscripten to generate the Wasm (as WebAssembly code is called), JavaScript and HTML files. By having the Wasm code load as a binary image, WebAssembly improves on the download/parse time of asm.js, and the code itself runs about 5 percent faster. We’re now seeing WebAssembly games every bit as good as those old Flash games that everybody used to play. For example, Funky Karts is a browser game written in C++/OpenGL ES 2 and WebAssembly. You can play the game instantly in your browser and read about its development. In addition to games, WebAssembly has been used in statistical visualization, ray tracing, emulators, voice commands, and software development. It makes possible web GUIs that are almost as good as desktop GUIs.