BT

With Firefox Version 58, WebAssembly Gets 10X Faster

| by Kevin Ball Follow 3 Followers on Jan 23, 2018. Estimated reading time: 2 minutes |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

With Firefox 58, Mozilla is shipping a 2-tiered compilation system for WebAssembly (WASM) that they claim allows them to parse and compile WASM code at 30-60 MB/s, or as fast as it comes in over the wire. Benchmarks indicate around a 10X speedup from previous versions of Firefox, and over 10X faster than Chrome.

In a Mozilla Hacks blog post, Lin Clark states some of the performance numbers they’re seeing:

On a desktop, we compile 30-60 megabytes of WebAssembly code per second. That’s faster than the network delivers the packets.

If you use Firefox Nightly or Beta, you can give it a try on your own device. Even on a pretty average mobile device, we can compile at 8 megabytes per second —which is faster than the average download speed for pretty much any mobile network.

Independent testers report being able to replicate these results. Reddit user a_potato_is_missing reported testing on Luke Wagner’s tanks compile time test with results on an Android Huawei P10 Lite going from 1.7MB/s in Firefox v57 to 11.8 MB/s in Firefox v58. Windows 10 desktop tests showed speedups from 9 MB/s on v57 to 52.8MB/s on v58. By comparison, Chrome lagged behind at 1MB/s on the Android and 4.1 MB/s on the desktop.

The speed gains come on top of already observed performance gains of WebAssembly over JavaScript. Earlier reports include a case study by Figma showing 3X load-time improvements by switching to WebAssembly and benchmarks published on Hackernoon showing 30% execution time speedups for computationally intensive graphical programs.

In a the blog post, Lin Clark details how the compiler leverages Firefox’s parallel architecture to split the compilation process into two independent processes. The first starts execution immediately and compiles a baseline version of the code as fast as it comes in over the wire. The second compiles the code to an optimized version in a background thread. When the optimized version is complete, they swap it into place to make the code run even faster.

The new improvements mean that WebAssembly can be compiled as quickly as they come off the network. Yehuda Katz highlighted the implications of this for web development:

JavaScript code is much more expensive, byte for byte, than an image, because of the time spent parsing and compiling it.


It's possible to parse and compile wasm as fast as it comes over the network, which makes it much more like an image than JavaScript code.

Game changer!

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

. by Lyndon Samson

Hate the headline, 10X faster assembly(compilation) is different to 10x faster execution which most people would care about...

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT