Since the advent of web apps using technologies like AJAX, developers have been trying to bring desktop experiences to the browser. Google has been one of the most active in this area, creating Google Docs and its counterparts. Now that WebAssembly has arrived on the scene we’re seeing more companies trying to bring C++ to the web. Below are five applications of WebAssembly that present a sort of proof of concept for the viability of WebAssemby as a tool that will revolutionize the browser experience.
Jordan Mears, one of Google Earth’s engineers, once called Google Earth “a video game of the real world” in an interview. Coincidentally, as he later mentions in the same interview, Google Earth’s back end was first built using the same game engine that powered games like Crash Bandicoot. Of course, the application has grown a lot larger since its early days and is now available on various platforms. Now, the Google Earth team is working on porting Google Earth to Chromium-based browsers with WebAssembly. The preview is currently available. It remains to be seen how such a heavyweight application will perform on browsers that do not support WASM’s multi-threading feature.
What WebAssembly allows for is portability. Kean Walmsly announced a year ago that the AutoCAD software was finally going to be a cross-browser product. He explained how this works by saying, ‘A major part of AutoCAD’s C++ code base gets run through Emscripten (at least that’s my understanding – I’ll correct any details I get wrong) to be transpiled into WebAssembly.”
Since the desktop and browser version share the same code base, updates in the desktop can be easily shared with the browser version. The only drop off in the browser version is the lack of 3D models, one that Walmsly expects to be remedied soon.
Bar Code Scanner
When you think of Web Assembly, your mind doesn’t immediately travel to e-commerce; eBay’s engineers had the same issue until they realized that using an image processing feature requires heavy computation, a task that WebAssembly can gladly handle. This image processing feature comes in the form of a bar code scanner. The scanner, built using their proprietary C++ library, was performant when implemented in their app, but the web version was not nearly as successful. So, the team decided to port their C++ library to the web using WebAssembly. Their blog post is a great read. To sum it up, they wrangled with WebAssembly until they found a way to use three working threads to achieve near 100% accuracy with their bar code scanner.
Dropbox takes image processing on the web to another level with DivANS. The tool compresses files in the client so that the server doesn’t have to get involved in the time-consuming business of file compression. That’s not to mention the fact that the staged methods DivANS uses regardless of where it’s used already makes it a very efficient compression tool.