59 releases (breaking)

new 0.44.0 Mar 29, 2025
0.42.1 Mar 20, 2025
0.40.0 Nov 27, 2024
0.36.0 Jul 24, 2024
0.1.1 Mar 24, 2018

#8 in WebAssembly

Download history 113598/week @ 2024-12-08 93034/week @ 2024-12-15 35801/week @ 2024-12-22 50714/week @ 2024-12-29 92345/week @ 2025-01-05 132966/week @ 2025-01-12 113661/week @ 2025-01-19 97066/week @ 2025-01-26 112892/week @ 2025-02-02 118865/week @ 2025-02-09 116735/week @ 2025-02-16 106999/week @ 2025-02-23 106096/week @ 2025-03-02 110688/week @ 2025-03-09 101662/week @ 2025-03-16 114560/week @ 2025-03-23

439,933 downloads per month
Used in 399 crates (48 directly)

MIT/Apache

3MB
66K SLoC

Continuous Integration Test Coverage Documentation Crates.io
ci codecov docs crates

Wasmi - WebAssembly (Wasm) Interpreter

Wasmi is an efficient and lightweight WebAssembly interpreter with a focus on constrained and embedded systems.

Security Audits

Wasmi is suitable for safety critical use cases and has been audited several times already.

Wasmi Version(s) Auditor Contractor Report
0.36.0-0.38.0 Runtime Verification Inc. Stellar Development Foundation PDF
0.31.0 SRLabs Parity Technologies PDF

Distinct Features

  • Simple, correct and deterministic execution of WebAssembly.
  • Low-overhead and cross-platform WebAssembly runtime for embedded environments.
  • JIT bomb resisting translation.
  • Loosely mirrors the Wasmtime API.
  • 100% WebAssembly spec testsuite compliance.
  • Built-in support for fuel metering.
  • Supports the official Wasm C-API.

Usage

Refer to the Wasmi usage guide to learn how properly to use Wasmi.

WebAssembly Features

WebAssembly Proposal WebAssembly Proposal
mutable-global 0.14.0 custom-page-sizes 0.41.0
saturating-float-to-int 0.14.0 memory64 0.41.0
sign-extension 0.14.0 wide-arithmetic 0.42.0
multi-value 0.14.0 simd 0.43.0
bulk-memory 0.24.0 relaxed-simd 0.44.0
reference-types 0.24.0 📅 function-references Tracking Issue
tail-calls 0.28.0 📅 gc Tracking Issue
extended-const 0.29.0 📅 threads Tracking Issue
multi-memory 0.37.0 📅 exception-handling Tracking Issue
Embeddings
WASI WASI (wasip1) support via the wasmi_wasi crate.
C-API Official Wasm C-API support via the wasmi_c_api_impl crate.

Crate Features

Feature Crates Description
std wasmi
wasmi_core
wasmi_ir
wasmi_collections
Enables usage of Rust's standard library. This may have some performance advantages when enabled. Disabling this feature makes Wasmi compile on platforms that do not provide Rust's standard library such as many embedded platforms.

Enabled by default.
wat wasmi Enables support to parse Wat encoded Wasm modules.

Enabled by default.
simd wasmi
wasmi_core
wasmi_ir
wasmi_cli
Enables support for the Wasm simd and relaxed-simd proposals. Note that this may introduce execution overhead and increased memory consumption for Wasm executions that do not need Wasm simd functionality.

Disabled by default.
hash-collections wasmi
wasmi_collections
Enables use of hash-map based collections in Wasmi internals. This might yield performance improvements in some use cases.

Disabled by default.
prefer-btree-collections wasmi
wasmi_collections
Enforces use of btree-map based collections in Wasmi internals. This may yield performance improvements and memory consumption decreases in some use cases. Also it enables Wasmi to run on platforms that have no random source.

Disabled by default.
extra-checks wasmi Enables extra runtime checks in the Wasmi executor. Expected execution overhead is ~20%. Enable this if your focus is on safety. Disable this for maximum execution performance.

Disabled by default.

Development

Build & Test

Clone the Wasmi repository and build using cargo:

git clone https://github.com/wasmi-labs/wasmi.git --recursive
cd wasmi
cargo build
cargo test

Benchmarks

In order to benchmark Wasmi use the following command:

cargo bench

Use translate, instantiate, execute or overhead filters to only run benchmarks that test performance of Wasm translation, instantiation, execution or miscellaneous overhead respectively, e.g. cargo bench execute.

Supported Platforms

Wasmi supports a wide variety of architectures and platforms.

  • Fore more details see this list of supported platforms for Rust.
  • Note: Wasmi can be used in no_std embedded environments, thus not requiring the standard library (std).
  • Only some platforms are checked in CI and guaranteed to be fully working by the Wasmi maintainers.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~6.5MB
~120K SLoC