-
Notifications
You must be signed in to change notification settings - Fork 261
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
wasmparser
: Create abstraction for local initialization (simplify future optimizations)
#1870
wasmparser
: Create abstraction for local initialization (simplify future optimizations)
#1870
Conversation
This will make it simpler to optimize the internals since it won't change the usage sites.
Benchmarks showed that they have a minor effect.
How best to handle the |
Thanks for this! Does the |
When i benchmarked it locally, unfortunately it did. However, you are welcome to run benchmarks on your machine to test if this is was just a local artifact. I only have a Macbook M2 machine for local benchmarks. |
Oh sure yeah that's no problem, just double-checking. Since it's only used in the validator I think it's ok to move it under there to avoid dead code warnings. |
Okay I will fix this later. |
removes negation at call-site
this way we do not push the same local index multiple times. This is the same behavior as on `main`.
@alexcrichton I moved However, I conducted another benchmark run and mostly saw no improvements anymore compared to |
@alexcrichton I just removed the |
wasmparser
: Optimize local initialization trackingwasmparser
: Create abstraction for local initialization (simplify future optimizations)
This implements the
first_non_default
index optimization in this comment.Note that the issue also suggests using a bitmap instead of a
Vec<bool>
. This is not implemented in this PR as I was unsure if we should implement our own bitvec or use one from crates.io. Furthermore it seems that they are using abitvec
with 32-bit words and 16 words inline storage to avoid heap allocations and indirections for up to 512 locals, thus complicating the matter.Benchmarks
Minor improvements, not sure if within noise.