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.

Clark explained that decoding WebAssembly is simpler and faster than parsing JavaScript. This decoding and compilation could be divided across multiple threads, making baseline compilation quicker. Baseline-compiled code can start executing on the main thread without pausing for compilation. Other threads, meanwhile, work on a more optimized version of the code, which then can be swapped in so code is faster. 

Future plans call for decoding and compiling on the first page load and caching resulting machine code in the HTTP cache. When that URL is requested, precompiled machine code is sent, eliminating load times for subsequent page loads. While JavaScript bytecode is being cached in this manner in Firefox 58, work still needs to be done in order to cache machine code for WebAssembly files

Developers who use Firefox Nightly or beta can try out the technology on their own device at this link.

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags Firefox

More about Mozilla

Show Comments