/wasm3

🚀 The fastest WebAssembly interpreter

Primary LanguageCMIT LicenseMIT

Wasm3

WAPM GitHub issues Tests status GitHub license

A high performance WebAssembly interpreter written in C.

∼ 9.1x faster than other known wasm interpreters
∼ 4-5x slower than state of the art wasm JIT engines
∼ 12.6x slower than native execution
* Based on CoreMark 1.0 benchmark. Your mileage may vary.

Twitter

Getting Started

Here's an online demo and a small getting started guide:

LIVE DEMO

Status

wasm3 passes the WebAssembly spec testsuite and is able to run many WASI apps.

Minimum useful system requirements: ~64Kb for code and ~10Kb RAM

wasm3 runs on a wide range of architectures (x86, x64, ARM, MIPS, RISC-V, Xtensa, ARC32) and platforms:

  • Linux, Windows, OS X
  • Android, iOS
  • OpenWRT-enabled routers
  • Raspberry Pi, Orange Pi and other SBCs
  • MCUs: Arduino, ESP8266, ESP32, Particle, ... see full list
  • Browsers... yes, using WebAssembly itself!
  • wasm3 can execute wasm3 (self-hosting)

Libraries

Wasm3 can be used as a library for:

C/C++ │ GoLang │ Rust │ Arduino, PlatformIO, Particle

Motivation

Why use a "slow interpreter" versus a "fast JIT"?

In many situations, speed is not the main concern. Runtime executable size, code density, memory usage, startup latency can be all improved with the interpreter approach. Portability and security are much easier to achieve and maintain. Additionally, development impedance is much lower. A simple library like Wasm3 is easy to compile and integrate into an existing project. (Wasm3 builds in a just few seconds). Finally, on some platforms (i.e. iOS and WebAssembly itself) you can't generate executable code pages in runtime, so JIT is unavailable.

Why would you want to run WASM on microcontrollers?

Wasm3 started as a research project and remains so by many means. Evaluating the engine in different environments is part of the research. Given that we have Lua, JS, Python, Lisp, (...) running on MCUs, WebAssembly is actually a promising alternative. It provides a completely sandboxed, well-defined and predictible environment. Among practical use cases, we can list edge computing, scripting, running IoT rules, blockchain contracts, etc.

Further Resources

Build and Development instructions

Testing & Fuzzing

Performance

Interpreter Architecture

License

This project is released under The MIT License (MIT)