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 CodeMap::alloc_funcs API #1125

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Add CodeMap::alloc_funcs API #1125

merged 2 commits into from
Jul 11, 2024

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Jul 11, 2024

The new CodeMap::alloc_funcs replaces the CodeMap::alloc_func API.

The advantage is that fewer CodeMap locks are required to allocate multiple EngineFunc at the same time which is the only way CodeMap::alloc_func was used.

Also this PR introduces the new EngineFuncSpan and EngineFuncSpanIter abstractions which significantly improve space efficiency of storing newly allocated contiguous EngineFunc indices returned by CodeMap::alloc_funcs.

This allowed us to optimize the way ModuleHeader and ModuleBuilder store and manage allocated EngineFuncs.

Benchmarks conducted locally confirm that this is a huge performance improvement, especially for lazy Wasm module compilation:

image

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

Attention: Patch coverage is 83.13253% with 14 lines in your changes missing coverage. Please review.

Project coverage is 80.56%. Comparing base (b42fd3b) to head (146fa9e).

Files Patch % Lines
crates/wasmi/src/engine/code_map.rs 77.77% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1125      +/-   ##
==========================================
+ Coverage   80.54%   80.56%   +0.02%     
==========================================
  Files         273      273              
  Lines       25087    25080       -7     
==========================================
  Hits        20206    20206              
+ Misses       4881     4874       -7     

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

@Robbepop Robbepop merged commit 05a5228 into main Jul 11, 2024
18 checks passed
@Robbepop Robbepop deleted the rf-alloc-funcs-api branch July 11, 2024 10:10
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