1 of 16

EWASM Benchmarking

2 of 16

Context

  • EWASM is a sound idea but there are questions about practicality (i.e. performance)
  • Compilers, interpreters, hybrids (JITs)... What engines/strategies are viable for precompiles and contracts?

3 of 16

Benchmarking Approach

  • Compilers:
    • Measure compile time, runtime of ewasm precompiles.
    • Establish gas pricing estimates given 10mil/gas block limit.
  • Interpreters:
    • Measure instantiation time, execution time of ewasm precompiles.
    • Measure gas costs for commonly-used contract types (e.g. wasm ERC20)

4 of 16

Benchmarked Engines

  • Compilers:
    • Life (LLVM: compiled to C and then to native)
  • JITs:
    • WAVM
  • Interpreters:
    • Wabt
    • Binaryen
    • Wasmtime

5 of 16

Results

6 of 16

7 of 16

8 of 16

9 of 16

10 of 16

11 of 16

12 of 16

13 of 16

14 of 16

15 of 16

Ewasm Contracts

Interpreter

Compiler

Transfer tokens

48 microseconds

212 microseconds

Get balance

30 microseconds

216 microseconds

  • Simple contracts are fast, even on a mid-grade laptop
  • Numbers do not include disk IO for storage
  • Interpreters are faster than compilers (WAVM) for simple contracts (unexpected).

16 of 16

Interpretation of Results

  • Execution time of Ewasm code compiled to native is acceptable.
  • Interpreters are too slow for precompiles but fast enough for contract execution.
  • Compilation time for Ewasm to native is acceptable but may be problematic for user-deployed contracts.