notes

Not So Fast: Analyzing the Performance of WebAssembly vs. Native Code

Abhinav Jangda, Bobby Powers, Emery D. Berger, and Arjun Guha (University of Massachusetts Amherst)

Proc. of the 2019 USENIX Annual Technical Conference (USENIX ATC 19), Renton, Washington, Jul. 2019

[paper], [PDF], [video], [video (lightning talk)]

Benchmarks

The PLDI’17 paper’s suite of 24 benchmarks were designed to measure polyhedral loop optimization effectivity, so are small scientific computing programs (~100 LOC), not full applications. This paper uses more representative benchmarks that are compiled with Browserix-Wasm.

Browserix implements a Unix-compatible kernel in JS with full support for processes, files, pipes, blocking I/O, and other Unix features. This paper extends Browserix as Browserix-Wasm, to compile Unix programs to Wasm without modifications.

Performance gaps

More loads and stores

Code generated from WebAssembly has more loads and stores than native code due to:

More branches

Code generated from WebAssembly has more branches due to:

Increased code size

Code generated from WebAssembly has more L1 instruction cache misses due to the extra instructions from more register spills (poor register allocation) and extra branches (§6.3)