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

Optimize ValueStack #404

Merged
merged 7 commits into from
Aug 12, 2022
Merged

Optimize ValueStack #404

merged 7 commits into from
Aug 12, 2022

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Aug 12, 2022

Today I was casually profiling wasmi and found that the ValueStack was particularly hot even though it has already seen many optimizations. So I took the chance and optimized it further given the invariants during bytecode execution.

The results are approx. 10% performance improvement across the board.

The optimizations along the way:

  • Removed some unnecessary bounds checks in ValueStack.
  • Applied #[cold] to UntypedError::invalid_len() error constructor.
  • Avoid adding and subtracting 1 for each local.{get,set,tee} depth.
  • Simplify code for {i32,i64}.{div,rem}.

@Robbepop Robbepop merged commit 3886d91 into master Aug 12, 2022
@Robbepop Robbepop deleted the rf-opt-valuestack branch August 12, 2022 15:31
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