Firefox 58 will come with a new streaming and tiering compiler for WebAssembly


In November last year, Mozilla introduced a completely overhauled core engine for Firefox in Firefox Quantum (version 57). The update was claimed to be by far the biggest update yet since Firefox’s launch by Mozilla. Mozilla boasted it to be twice as fast as Firefox was 6 months back then. It gets even better, with the upcoming Firefox 58 and its improved streaming compilation and a new two-tiered WebAssembly compiler.

Streaming compilation, as the name suggests, compiles code even before they’re downloaded completely on your device. As the packets arrive, the code will be compiled on the fly saving you much time. This is useful at times where web service downloads lots of Javascript pages, making execution of scripts slower.

Mozilla explains how it works:

“If you start compiling the code earlier, you’ll finish compiling it earlier. That’s what streaming compilation does… makes it possible to start compiling the .wasm file as soon as possible. When you download a file, it doesn’t come down in one piece. Instead, it comes down in a series of packets. Before, as each packet in the .wasm file was being downloaded, the browser network layer would put it into an ArrayBuffer. Then, once that was done, it would move that ArrayBuffer over to the Web VM (aka the [JavaScript] engine). That’s when the WebAssembly compiler would start compiling. But there’s no good reason to keep the compiler waiting. It’s technically possible to compile WebAssembly line by line. This means you should be able to start as soon as the first chunk comes in. So that’s what our new compiler does. It takes advantage of WebAssembly’s streaming API.”

The update also includes a 2 tiered compiler architecture for WebAssembly. Together with these two improvements, the new compiler will perform 10 to 15 times faster than the exisiting compiler. Firefox 58 compiles 30-60 megabytes of WebAssembly code per second on the desktop, while on mobile it can compile at 8 megabytes per second.

Learn more about it here.

Get Firefox 58 beta for your device.

Source Mozilla
Via Neowin