With the recent release of Go 1.11, with experimental WebAssembly support, lots of people are having fun porting their existing projects to the web. This post looks at the process of porting quite a complex codebase, a Gameboy emulator, to the web.
In this case, the initial port was pretty trivial, it only took the author 5 mins to get the code running in the browser. However, managing I/O, i.e. rendering to the scree, handling keyboard input, was a challenge, with the final solution using Web Workers. There are also some interesting browser performance results, where Chrome is lagging behind quite significantly.
Cervus, Nebulet, and now WasmJit … yes, this is another kernel mode WebAssembly runtime. The goal here is to create a runtime which doesn’t require the standard OS ‘protection rings’, instead relying on the safe nature of the WebAssembly architecture, resulting in much lower overhead in I/O operations.
This project has sparked the usual long Hacker News thread, and multiple references to ‘that’ talk!
The Rust community have been working hard to resolve this, firstly they creates wasm-bindgen, that generates JS / Rust binding code to allow for a more ‘rich’ interface. And now, with web-sys, they have managed to generate bindings for all of the Web APIs! This really makes Rust a first-class citizen within the browser.
If you just like number-crunching, you might be interested in the wasm version of Cephes, which brings 100+ specialist maths functions to the web. Have fun with your Bessel Functions and your Confluent Hypergeometric!