-
Notifications
You must be signed in to change notification settings - Fork 213
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
Example of an unexpectedly-huge contract artifact. #6786
Comments
@aakoshh Do you have bandwidth to take a look at this? |
The first jump I found in the size was AztecProtocol/aztec-packages@3304046 where the Commands to check: PROGRAM_DIR=$pwd/noir-projects/noir-contracts
git checkout 3304046704e257902e32b86baf1aafc8b23bcaf6
cd noir/noir-repo
cargo run --release -p nargo_cli -- --program-dir $PROGRAM_DIR compile --package stateful_test_contract
jq '.functions | sort_by(.name) | .[] | {name: .name, size: .bytecode | length }' $PROGRAM_DIR/target/stateful_test_contract-StatefulTest.json |
Within the syncing PR AztecProtocol/aztec-packages#10307 that backs the above squashed commit, the two commits where there are significant bytecode size increases are:
|
The following is the printout of the number of lines in the SSA in AztecProtocol/aztec-packages@369ea54
We can see that there is a dramatic increase in the Compare it with the same in its parent commit AztecProtocol/aztec-packages@0577c1a
In this version Further digging revealed that Printing the number of arrays reveals where they get introduced. This is in 0577c1a
And this is in 369ea54:
The numbers show the count of of arrays that would be merged in the entry block of the functions, the only block let mut count = 0;
let block = function.entry_block();
for instruction in function.dfg[block].instructions() {
if let Instruction::IfElse { then_condition: _, then_value, else_value: _ } =
function.dfg[*instruction]
{
let then_value = function.dfg.resolve(then_value);
if let Type::Array(..) = function.dfg.type_of_value(then_value) {
count += 1;
}
}
} So the question is why has One further thing to look at would be whether there were more stores to arrays in this commit then before.
whereas after there are more if-then-else and less stores, but the if-then-else's don't get eliminated, which then plays a magnified role during
|
Looking at what is causing the following:
Printing SSA sizes does not reveal any smoking gun, the numbers are similar to above.
Whereas in 70cf870f we have a smaller SSA, but the final ACIR opcode count is 5x larger:
The following are the statistics of how many ACIR opcodes were generated from how many encountered In feef655:
In 70cf870f:
The biggest visible change is in the ratio of opcodes generated from Just looking at binary instructions:
and then:
|
AztecProtocol/aztec-packages#10546
In particular,
create_note
andcreate_note_no_init_check
https://github.com/AztecProtocol/aztec-packages/blob/6f209fb69fcce868c6e0fe9b79b5ac3f3a1e5c48/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr#L45
The text was updated successfully, but these errors were encountered: