-
Notifications
You must be signed in to change notification settings - Fork 1
Description
During the call I mentioned that we might not only want to look at the file size improvements when judging whether compact imports are worth it. I just tested with for a small (~5kB) Rust compiled Wasm file that is typical for certain users of Wasmi with Wasmi's lazy translation mode. I did the comparison by emptying all the module name identifiers of the import section to "simulate" the effect of this proposal.
This benchmarks the validation performance of this small Wasm file original and "stripped".
The file size of the stripped Wasm file only decreased by ~0.8% compared to the original.
| Original | Stripped | Improvement (%) | |
|---|---|---|---|
| Parse + Validate | ~9.6us | ~9.1us | ~5.3% |
| Only Parse* | ~4.7us | ~4.45us | ~5.3% |
*: This is useful if a user knows that the input has already been validated prior.
So all in all more modest improvements that I'd had hoped but still the effect is larger than those ~0.8% file size reduction. Also the effect might be amplified slightly with a proper implementation.
The reason for this is that most of a Wasm file size is comprised of function bodies. However, when deferring parsing, validation and translation of those, the remaining parts of the Wasm binary become way more influential concerning performance.
For larger Wasm binaries this effect is less noticable though.