Skip to content

Conversation

@Robbepop
Copy link

@Robbepop Robbepop commented Jan 25, 2026

This PR replaces the current usage of wasmi::Linker with the more low-level and efficient Instance::new.

The new linking facilities act lazily and only populate the externals buffer with what the module to be instantiated actually needs. In contrast the old linking facilities act eagerly and populate all available host functions onto the linker even if only a tiny fraction of them are in use.

This should improve performance and may even improve binary artifact size.

Caution: I was not able to locate end-to-end tests so I could not really test the changes. The old test is also no longer applicable to the new API. A new API that tests all paths would require a Wasm module that imports all available host functions.

This PR is best reviewed commit by commit.

A follow-up to further improve performance might be to re-use the externals buffer for multiple instantiations if that's a common use case.

@Robbepop Robbepop changed the title Improve linking facilities Improve Wasm module linking facilities Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant