Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Module::new_unchecked to avoid expensive Wasm function validation #817

Closed
Robbepop opened this issue Nov 30, 2023 · 0 comments · Fixed by #829
Closed

Add Module::new_unchecked to avoid expensive Wasm function validation #817

Robbepop opened this issue Nov 30, 2023 · 0 comments · Fixed by #829
Assignees
Labels
enhancement New feature or request register-machine A work item for the register-machine engine.

Comments

@Robbepop
Copy link
Member

Users of wasmi might sometimes know ahead of time that the binary blob that they are working on has already been validated to be a proper Wasm binary. In these cases wasmi currently does not provide an API to avoid the duplicated Wasm validation since Module::new always validates its input bytes.

This issue proposes to add

impl Module {
    pub unsafe fn new_unchecked(engine: &Engine, wasm: impl Read) -> Result<Self, Error> { ... }
}

Note that we still return a Result<Self, Error> since this does not drop all checks, only the very expensive checks from validating Wasm functions.

Together with lazy compilation this should provide a good amount of speedup when working under these conditions for users of the wasmi crate.

@Robbepop Robbepop added enhancement New feature or request register-machine A work item for the register-machine engine. labels Nov 30, 2023
@Robbepop Robbepop self-assigned this Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request register-machine A work item for the register-machine engine.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant