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 global.get and global.set execution #427

Merged
merged 5 commits into from
Sep 6, 2022
Merged

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Sep 6, 2022

Currently the global.get and especially global.set perform a lot of unnecessary conversions and checks.
For example global.set checks for global variable mutability and checks types even though that has already been done during Wasm validation at the time of wasmi bytecode execution.

This also adds a new benchmark to test global variable set and get performance and shows a roughly 17% performance boost.

@Robbepop Robbepop merged commit 0a4fc03 into master Sep 6, 2022
@Robbepop Robbepop deleted the rf-opt-globals branch September 6, 2022 15:27
Robbepop added a commit that referenced this pull request Sep 10, 2022
* add benchmarks to test global.{get,set} performance

* add crate private Global::{set_untyped, get_untyped} API

These are more efficient but less safe methods for Global::{set,get} for when no typed values are required.

* use the new Global::{set_untyped, get_untyped} APIs from within the interpreter

* make GlobalEntity::get_untyped crate private

* implement GlobalEntity::{get,set} in terms of {get,set}_untyped
# Conflicts:
#	wasmi_v1/src/engine/exec_context.rs
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