-
Notifications
You must be signed in to change notification settings - Fork 828
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
pallet-revive: Fix the contract size related benchmarks #7568
Conversation
All GitHub workflows were cancelled due to failure one of the required jobs. |
/cmd fmt --clean |
Co-authored-by: PG Herveou <[email protected]>
Co-authored-by: PG Herveou <[email protected]>
pub fn sized(size: u32) -> Self { | ||
// Due to variable length encoding of instructions this is not precise. But we only | ||
// need rough numbers for our benchmarks. | ||
Self::with_num_instructions(size / 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why we divide by 3? Is it a minimal instruction size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the average size of an instruction in the PolkaVM blob. But since it uses variable size encoding its not excact (see comment above). I played around a little with divisors until i get roughly the amount of instructions to hit the max blob size.
) Partly addresses paritytech#6157 The benchmarks measuring the impact of contract sizes on calling or instantiating a contract were bogus because they needed to be written in assembly in order to tightly control the basic block size. This fixes the benchmarks for: - call_with_code_per_byte - upload_code - instantiate_with_code And adds a new benchmark that accounts for the fact that the interpreter will always compile whole basic blocks: - basic_block_compilation After this PR only the weight we assign to instructions need to be addressed. --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: PG Herveou <[email protected]>
Partly addresses #6157
The benchmarks measuring the impact of contract sizes on calling or instantiating a contract were bogus because they needed to be written in assembly in order to tightly control the basic block size.
This fixes the benchmarks for:
And adds a new benchmark that accounts for the fact that the interpreter will always compile whole basic blocks:
After this PR only the weight we assign to instructions need to be addressed.