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 |
|
0.1.1 | Mar 24, 2018 |
#8 in WebAssembly
439,933 downloads per month
Used in 399 crates
(48 directly)
3MB
66K
SLoC
Continuous Integration | Test Coverage | Documentation | Crates.io |
---|---|---|---|
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 | |
0.31.0 |
SRLabs | Parity Technologies |
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
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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