Wasmi 2.0 - Engineering of the Fastest Wasm Interpreters

29 points by isuffix 6 days ago on lobsters | 3 comments

robbepop | 6 days ago

Wasmi 2.0 author here. (thanks for the invite @hauleth)

I worked 9 months for Wasmi 2.0 and preparations and writing for this article took ~1.5 months. My hope is that this write-up helps others writing fast interpreters to bring the ecosystem forward.

Happy to answer all questions!

andyferris | 5 days ago

Looks nice!

How much faster again is (JIT or even AOT) compiled WASM compared to Wasmi 2.0? I'm just trying to place where I might use this in place of those.

robbepop | 5 days ago

It depends on several factors:

What do you mean with JIT?

  1. Optimizing JIT such as Wasmtime Cranelift?
  2. Baseline JIT such as Wasmtime Winch or Wasmer Singlepass?
  3. Or even precompiled machine code via LLVM? (e.g. Wasmer LLVM)

For example, the geometric mean across all wasmi-benchmarks tests:

On my Apple M2 Pro, Wasmi is ..

  • ~2.5x slower than Winch
  • ~1.9x slower than Wasmer's Singlepass
  • ~7x slower than Wasmtime Cranelift

Intel i7700:

  • ~2.5x slower than Winch
  • ~2.1x slower than Wasmer Singlepass
  • ~5.3x slower than Wasmtime Cranelift

AMD EPYC 7763:

  • ~5.2x slower than Winch
  • ~4.2x slower than Wasmer Singlepass
  • ~10.7x slower than Wasmtime Cranelift

As you can see on AMD EPYC 7763, Wasmi performs worse in comparison.

All in all I am very happy with Wasmi's execution performance in comparison to JITs especially considering its outstanding startup performance even compared to baseline JITs such as Winch and Wasmer's Singlepass.

Note: Wasmer Singlepass fares very badly on any floating point benchmark, drastically reducing its overall performance.