Are You Ready for the WebAssembly Revolution?
This is the dream of the developers behind WebAssembly (WASM), a new-ish project to package web applications as low-level bytecode to be run by web browsers. We learned about WASM through Jay Phelps, Netflix senior software engineer, who gave a talk about WASM at the All Things Open conference last month in Raleigh North Carolina.
“I think we will eventually be using a language that doesn’t even exist today,” Phelps said. Instead, what might evolve would be a language designed to form the ground-up specifically to target the web applications.
With WASM, developers can write their programs in C, C++ or Rust — and other statically typed languages will be supported in the future — which is then compiled into low-level bytecode, which the browser can then execute within a virtual machine.
There have been attempts to bring binary code to the Web before, at least since Java Applets of two decades ago, which were clunky and slow to load, largely because they operated entirely outside the browser environs. More recently, Google attempted work of this sort as Native Client, which was discontinued in favor of WASM.
The best use for WebAssembly now would be for those web applications that demand much of the CPU. Smaller programs would lag from the time it takes to call them from the browser. “You want to cross that boundary only when you have some heavy computational thing,” Phelps said. Video encoding or games are prime potential uses. Game engine provider Unity assembled a demo game involving the driving of tanks around a virtual sandbox.
The Ethereum blockchain platform is even investigating the possibility of running WebAssembly on the servers (The work raises the interesting possibility of WebAssembly not only being used in browsers but even as a stand-alone cross-platform development environment, Phelps pointed out).