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 non-streaming Wasm module creation #1035

Merged
merged 18 commits into from
May 13, 2024
Merged

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented May 13, 2024

So far Wasmi only supported streaming parsing, validation and compilation of Wasm modules via Module::new.

This PR renames both Module::new and Module::new_unchecked to new_streaming and new_streaming_unchecked respectively. Also it adds 2 new methods Module::new and Module::new_unchecked that take a wasm: &[u8] byte slice argument instead of a stream: impl Read argument. The idea behind this change is that if streaming compilation is not necessary we can optimize the process.

Benchmarks

The benchmarks locally show amazing performance wins across the board.
For lazy and especially lazy-unchecked compilation I consistently saw improvements between 40-80% (5x speed-up).

image

image

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 81.86275% with 37 lines in your changes are missing coverage. Please review.

Project coverage is 80.86%. Comparing base (3880d86) to head (4c66abc).
Report is 1 commits behind head on master.

Files Patch % Lines
crates/wasmi/src/module/parser/streaming.rs 84.15% 16 Missing ⚠️
crates/wasmi/src/module/parser/buffered.rs 82.43% 13 Missing ⚠️
crates/wasmi/src/module/mod.rs 40.00% 6 Missing ⚠️
crates/cli/src/context.rs 0.00% 1 Missing ⚠️
crates/wasmi/src/module/parser.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1035      +/-   ##
==========================================
+ Coverage   80.82%   80.86%   +0.03%     
==========================================
  Files         269      271       +2     
  Lines       24825    24896      +71     
==========================================
+ Hits        20065    20132      +67     
- Misses       4760     4764       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Robbepop Robbepop merged commit 0288016 into master May 13, 2024
18 checks passed
@Robbepop Robbepop deleted the rf-non-streaming-parsing branch May 13, 2024 13:08
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