Cargo Features
[dependencies]
wasmi = { version = "0.39.1", default-features = false, features = ["std", "hash-collections", "prefer-btree-collections", "extra-checks"] }
- default = std
-
The
std
feature is set by default wheneverwasmi
is added without
somewhere in the dependency tree.default-features = false - std default
-
Enables std of arrayvec, spin, wasmi_collections, wasmi_core, and wasmparser-nostd
spin:
Enables std-only features such as yield-relaxing.
- hash-collections
-
Enables hash-collections of wasmi_collections
wasmi_collections:
Hash collections usage:
- Enable
hash-collections
to make use of hash-based collections inwasmi_collections
. - Enable
prefer-btree-collections
to still use btree-based collections even when thehash-collections
crate feature is enabled.
Note:
- Not enabling
hash-collections
allowswasmi_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
- Enable
- prefer-btree-collections
-
Enables prefer-btree-collections of wasmi_collections
- 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.