Git Product home page Git Product logo

wasmi's Introduction

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.

Version 0.31.0 has been audited by SRLabs.

Announcement: Transfer of Ownership

As of 2024-02-01, the original owner and maintainer of the Wasmi project, Parity Technologies, has officially transferred ownership of the project to me, Robin Freyler. Read more about this transfer here.

Distinct Features

The following list states some of the distinct features of Wasmi.

  • 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.

WebAssembly Proposals

The new Wasmi engine supports a variety of WebAssembly proposals and will support even more of them in the future.

WebAssembly Proposal Status Comment
mutable-global Since version 0.14.0.
saturating-float-to-int Since version 0.14.0.
sign-extension Since version 0.14.0.
multi-value Since version 0.14.0.
bulk-memory Since version 0.24.0. (#628)
reference-types Since version 0.24.0. (#635)
simd Unlikely to be supported.
tail-calls Since version 0.28.0. (#683)
extended-const Since version 0.29.0. (#707)
function-references 📅 Planned but not yet implemented. (#774)
gc 📅 Planned but not yet implemented. (#775)
multi-memory 📅 Planned but not yet implemented. (#776)
threads 📅 Planned but not yet implemented. (#777)
relaxed-simd Unlikely to be supported since simd is unlikely to be supported.
component-model 📅 Planned but not yet implemented. (#897)
WASI 👨‍🔬 Experimental support via the wasmi_wasi crate or the Wasmi CLI application.

Usage

As CLI Application

Install the newest Wasmi CLI version:

cargo install wasmi_cli

Run wasm32-unknown-unknown or wasm32-wasi Wasm binaries:

wasmi_cli <WASM_FILE> --invoke <FUNC_NAME> [<FUNC_ARGS>]*

As Rust Library

Refer to the Wasmi crate docs to learn how to use the Wasmi crate as library.

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.

We maintain a timeline for benchmarks of every commit to master that can be viewed here.

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.

Production Builds

In order to reap the most performance out of Wasmi we highly recommended to compile the Wasmi crate using the following Cargo profile:

[profile.release]
lto = "fat"
codegen-units = 1

When compiling for the WebAssembly target we highly recommend to post-optimize Wasmi using Binaryen's wasm-opt tool since our experiments displayed a 80-100% performance improvements when executed under Wasmtime and also slightly smaller Wasm binaries.

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.

wasmi's People

Contributors

robbepop avatar pepyakin avatar dependabot[bot] avatar nikvolf avatar sergejparity avatar yjhmelody avatar eira-fransham avatar elichai avatar arkpar avatar reuvenpo avatar berrysoft avatar ithinuel avatar sorpaas avatar tomaka avatar oluwamuyiwa avatar leoyvens avatar athei avatar aldaronlau avatar chevdor avatar bddap avatar barafael avatar kpp avatar taegyunkim avatar thabokani avatar therdel avatar tbu- avatar tjpalmer avatar rcny avatar willglynn avatar lygstate avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.