Firefox speeds up WebAssembly through streaming compilation
Firefox 58 begins compiling WebAssembly code as it downloads, and taps multiple threads for both compiling and optimization
Mozilla’s Firefox 58 browser, to be released January 23, features a compilation technology designed to make the WebAssembly portable code format run even faster.
This performance boost is enabled by streaming compilation, in which the browser compiles WebAssembly code even as it is being downloaded. Code begins compiling sooner and thus finishes executing sooner. Firefox 58 also features a new two-tiered compiler, with a new baseline compiler that compiles code 10 to 15 faster than the optimizing compiler.
The combination of streamed and two-tiered compilation results in WebAssembly code being compiled faster than it can be delivered by the network. Mozilla notes that, on a desktop computer, it has been able to compile 30 to 60 megabytes of WebAssembly code per second. On an “average” mobile device, WebAssembly code compiles at 8 megabytes per second, which is still faster than the download speed for just about any mobile network, said Lin Clark, Mozilla senior evangelist.
Developers who use Firefox Nightly or beta can try out the technology on their own device at this link.