bytecodealliance / bytecodealliance/wasmtime

Module registry: investigate data-structure optimizations

Open
#12,111 0 comments 0 reactions 0 assignees View on GitHub
performance wasmtime
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

In #12051 we added a new level of data structures to the per-store module registry due to the distinction between `EngineCode` and `StoreCode`. This leads to a small but consistent observed increase in instantiation time (~3% or 40ns in tests with a store of one small module).

In theory we could avoid the cost of materializing a separate `StoreCode` by making `ModuleWithCode` carry a view on *some* text/range, and building it to use `EngineCode`'s text slice directly in the non-debug case. The commit [here](https://github.com/cfallin/wasmtime/commit/73b0bbe8d5101e5849a22404f2809895f0ee7495) did enough of this to avoid a lookup in the engine-to-store-code map on the funcref init path, but we could carry it a bit further and avoid creating a `StoreCode` at all at instantiation.

There may be other optimizations we could do as well, after profiling.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.