Cargo Features

[dependencies]
wasmi = { version = "0.44.0", default-features = false, features = ["std", "hash-collections", "prefer-btree-collections", "wat", "simd", "extra-checks"] }
default = std, wat

These default features are set whenever wasmi is added without default-features = false somewhere in the dependency tree.

std default wat

Enables std of arrayvec, spin ^0.9, wasmi_collections, wasmi_core, and wasmparser ^0.227.1

spin:

Enables std-only features such as yield-relaxing.

hash-collections

Enables hash-collections of wasmi_collections and wasmparser ^0.227.1

wasmi_collections:

Hash collections usage:

  • Enable hash-collections to make use of hash-based collections in wasmi_collections.
  • Enable prefer-btree-collections to still use btree-based collections even when the hash-collections crate feature is enabled.

Note:

  • Not enabling hash-collections allows wasmi_collections to drop lots of hash-based dependencies and thus decrease compilation times significantly.
  • Btree-based collections can be useful for environments without a random source.

Which collections will be used:

hash-collections prefer-btree-collections usage
       false   |                    false   |      btree
        true   |                    false   |      hash
       false   |                     true   |      btree
        true   |                     true   |      btree

prefer-btree-collections

Enables prefer-btree-collections of wasmi_collections and wasmparser ^0.227.1

wasmparser:

Tells the wasmparser crate to prefer using its built-in btree-based collections even if hash-collections is enabled.

wat default = std

Enables wat

simd

Enables simd of wasmi_core, wasmi_ir, and wasmparser ^0.227.1

wasmi_core:

Enables the Wasm simd proposal.

This also changes the size of UntypedVal from 64-bit to 128-bit which may have significant impact on performance and memory usage.

Affects translator::VisitSimdOperator

extra-checks

Enables extra checks performed during Wasmi bytecode execution.

These checks are unnecessary as long as Wasmi translation works as intended.
If Wasmi translation invariants are broken due to bugs, these checks prevent Wasmi execution to exhibit undefined behavior (UB) in certain cases.

Expected execution overhead is upt to 20%, if enabled.

- Enable if your focus is on safety.
- Disable if your focus is on execution speed.