Enhancing Web Application Performance with DITWO: A Study on WebAssembly Optimizations

In the current era of advanced web applications, WebAssembly (wasm) compilation toolchains’ development has seen significant growth. Complex software applications written in various high-level programming languages are compiled into wasm executables. These executables are then swiftly and safely executed in a virtual machine. The performance of these wasm executables is greatly influenced by compiler optimizations.

Although WebAssembly executables are increasingly being used, there’s an indication from recent studies that real-world wasm applications are not up to speed as expected. This suggests possible shortcomings in the wasm optimization process.

DITWO: Differential Testing Framework

In order to investigate and understand the current state of wasm optimizations, we present DITWO. It’s a differential testing framework designed to uncover missed optimizations in wasm optimizers. DITWO works by compiling a C program into both a native x86 executable and a wasm executable. Then, by analyzing optimization indication traces (OITraces) that result from running each of these executables, we can identify any missed opportunities for optimization.

OITraces: The Indicators of Optimization

An OITrace is composed of global variable writes and function calls. These two elements are practical performance indicators that systematically reflect the level of optimization across each wasm and native executables.

To gauge the efficiency of wasm optimizations, DITWO was used to analyze the official wasm optimizer, wasm-opt. The findings unveiled 1,293 inputs that triggered missed optimizations on wasm-opt.

Uncovering the Root Causes of Missed Optimizations

After extensive manual review and analysis, we were able to identify nine root causes for all these missed optimizations. Based on our estimates, rectifying these identified missed optimizations can result in a notable performance gain of at least 17.15%.

Lessons Learnt on Wasm Optimizations

From our analysis, several lessons can be drawn to help deliver better wasm optimizations in the future:

  1. Greater emphasis on testing: More rigorous testing needs to be performed on wasm optimization techniques.
  2. Focus on common patterns: Patterns frequently used in practice should be focused upon to identify any further missed optimizations.
  3. Benchmarking against native compilers: Learning and adapting practices from native compilers might prove beneficial.
  4. Dynamic and continuous learning: The ever-evolving nature of WebAssembly calls for a continuous learning process in order to stay updated with optimization techniques.

In conclusion, our finding underscores the need to better understand WebAssembly and its optimization techniques to enhance the execution of web applications.

Tags: #WebAssembly, #DITWO, #CompilerOptimization, #WASM-Optimization.

Reference Link