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

chore: try out the "fix: always check index out of bounds for arrays … #7779

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asterite
Copy link
Contributor

@asterite asterite commented Aug 5, 2024

…and slices" PR

This PR applies the changes from noir-lang/noir#5676 to see how benchmarks behave.

Copy link
Contributor

github-actions bot commented Aug 5, 2024

Changes to circuit sizes

Generated at commit: 6aa5a44ede86574ac4e4dc458f47dce10a1d737c, compared to commit: 07ee990d2bd5dbe6a98c1fe022843de676511498

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_reset_tiny +4,642 ❌ +8.04% +4,413 ❌ +4.49%
private_kernel_reset_small +4,782 ❌ +7.82% +4,546 ❌ +3.66%
private_kernel_inner +2,440 ❌ +4.88% +2,318 ❌ +3.46%
private_kernel_reset_medium +5,062 ❌ +7.45% +4,812 ❌ +2.73%
private_kernel_reset_big +5,622 ❌ +6.89% +5,344 ❌ +1.90%
private_kernel_reset +6,742 ❌ +6.19% +6,408 ❌ +1.31%
private_kernel_tail_to_public +2,074 ❌ +2.72% +1,985 ❌ +0.73%
private_kernel_tail +1,480 ❌ +7.15% +1,406 ❌ +0.40%
public_kernel_app_logic +646 ❌ +0.22% +613 ❌ +0.10%
public_kernel_tail +9,206 ❌ +0.92% +8,778 ❌ +0.09%
public_kernel_setup +703 ❌ +0.32% +671 ❌ +0.04%
public_kernel_teardown +646 ❌ +0.22% +614 ❌ +0.04%
rollup_base +550 ❌ +0.16% +517 ❌ +0.01%
private_kernel_init -10,926 ✅ -38.17% -14,054 ✅ -36.14%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_reset_tiny 62,388 (+4,642) +8.04% 102,599 (+4,413) +4.49%
private_kernel_reset_small 65,940 (+4,782) +7.82% 128,690 (+4,546) +3.66%
private_kernel_inner 52,459 (+2,440) +4.88% 69,269 (+2,318) +3.46%
private_kernel_reset_medium 73,047 (+5,062) +7.45% 181,051 (+4,812) +2.73%
private_kernel_reset_big 87,260 (+5,622) +6.89% 285,980 (+5,344) +1.90%
private_kernel_reset 115,684 (+6,742) +6.19% 495,836 (+6,408) +1.31%
private_kernel_tail_to_public 78,235 (+2,074) +2.72% 273,501 (+1,985) +0.73%
private_kernel_tail 22,189 (+1,480) +7.15% 352,422 (+1,406) +0.40%
public_kernel_app_logic 294,914 (+646) +0.22% 619,734 (+613) +0.10%
public_kernel_tail 1,010,918 (+9,206) +0.92% 9,276,815 (+8,778) +0.09%
public_kernel_setup 217,658 (+703) +0.32% 1,600,120 (+671) +0.04%
public_kernel_teardown 296,524 (+646) +0.22% 1,680,621 (+614) +0.04%
rollup_base 342,280 (+550) +0.16% 8,511,536 (+517) +0.01%
private_kernel_init 17,695 (-10,926) -38.17% 24,830 (-14,054) -36.14%

@AztecBot
Copy link
Collaborator

AztecBot commented Aug 5, 2024

Benchmark results

Metrics with a significant change:

  • protocol_circuit_witness_generation_time_in_ms (private-kernel-init): 244 (-40%)
  • protocol_circuit_proving_time_in_ms (base-parity): 1,133 (-34%)
Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Proof generation

Each column represents the number of threads used in proof generation.

Metric 1 threads 4 threads 16 threads 32 threads 64 threads
proof_construction_time_sha256_ms 5,717 1,546 708 (+1%) 747 763
proof_construction_time_sha256_30_ms 11,759 3,144 1,414 (+1%) 1,439 (+1%) 1,473 (+1%)
proof_construction_time_sha256_100_ms 43,959 (+1%) 12,400 (-1%) 5,723 (+2%) 5,616 (+2%) 5,544 (+1%)
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 59.0 (+2%) 88.0
proof_construction_time_poseidon_hash_30_ms 1,517 415 200 228 (+1%) 270
proof_construction_time_poseidon_hash_100_ms 5,612 1,512 676 738 747

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 4 txs 8 txs 16 txs
l1_rollup_calldata_size_in_bytes 740 740 740
l1_rollup_calldata_gas 6,716 6,720 6,716
l1_rollup_execution_gas 611,983 612,138 612,285
l2_block_processing_time_in_ms 248 (+2%) 444 800 (+4%)
l2_block_building_time_in_ms 9,399 (+1%) 18,412 (+1%) 36,497 (+1%)
l2_block_rollup_simulation_time_in_ms 9,398 (+1%) 18,412 (+1%) 36,497 (+1%)
l2_block_public_tx_process_time_in_ms 7,818 (+1%) 16,627 (+1%) 34,640 (+1%)

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 8 txs.

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 2,795 (+3%) 3,625
node_database_size_in_bytes 12,742,736 16,871,504
pxe_database_size_in_bytes 16,254 26,813

Circuits stats

Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.

Circuit simulation_time_in_ms witness_generation_time_in_ms input_size_in_bytes output_size_in_bytes proving_time_in_ms proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 95.5 ⚠️ 244 (-40%) 19,976 (-9%) 44,858 N/A N/A N/A N/A
private-kernel-inner 172 (+4%) 746 (+3%) 72,932 (+1%) 45,005 N/A N/A N/A N/A
private-kernel-tail 719 (+6%) 874 (+1%) 53,804 (+1%) 49,801 N/A N/A N/A N/A
base-parity 5.96 (+1%) 584 (-3%) 160 96.0 ⚠️ 1,133 (-34%) 13,188 19.0 65,536
root-parity 110 125 (+12%) 69,084 96.0 31,628 (+12%) 13,188 19.0 4,194,304
base-rollup 2,938 5,227 (-5%) 182,288 664 99,689 (+15%) 14,020 45.0 16,777,216
root-rollup 98.3 112 (+10%) 54,525 716 28,612 (+13%) 13,988 44.0 4,194,304
public-kernel-setup 90.3 (-1%) 2,792 (+3%) 102,617 69,814 17,355 (+12%) 127,172 3,581 2,097,152
public-kernel-app-logic 105 (+1%) 4,154 102,617 69,814 10,470 (+13%) 127,172 3,581 1,048,576
public-kernel-tail 573 (-1%) 31,264 (+13%) 402,342 10,878 102,408 (+10%) 26,436 433 16,777,216
private-kernel-reset-tiny 203 (+5%) 869 69,769 (+2%) 44,750 N/A N/A N/A N/A
private-kernel-tail-to-public 5,221 (+5%) 1,613 1,014,131 (+4%) 1,697 N/A N/A N/A N/A
public-kernel-teardown 87.8 (+1%) 4,138 102,617 69,814 18,822 (+13%) 127,172 3,581 2,097,152
merge-rollup 61.1 (+2%) N/A 35,742 664 N/A N/A N/A N/A
undefined N/A N/A N/A N/A 155,303 (+3%) N/A N/A N/A

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms proof_size_in_bytes proving_time_in_ms
ContractClassRegisterer:register 1,344 11,731 333 (-1%) N/A N/A
ContractInstanceDeployer:deploy 1,408 11,731 18.0 N/A N/A
MultiCallEntrypoint:entrypoint 1,920 11,731 468 N/A N/A
GasToken:deploy 1,376 11,731 383 (-1%) N/A N/A
SchnorrAccount:constructor 1,312 11,731 175 N/A N/A
SchnorrAccount:entrypoint 2,304 11,731 565 N/A N/A
Token:privately_mint_private_note 1,280 11,731 221 (-7%) N/A N/A
FPC:fee_entrypoint_public 1,344 11,731 32.2 (+4%) N/A N/A
Token:transfer 1,312 11,731 812 N/A N/A
AuthRegistry:set_authorized (avm) 18,491 N/A N/A 147,456 2,506 (-5%)
FPC:prepare_fee (avm) 22,958 N/A N/A 147,520 3,181 (-5%)
Token:transfer_public (avm) 63,729 (+3%) N/A N/A 147,520 18,288 (+7%)
AuthRegistry:consume (avm) 42,764 (+3%) N/A N/A 147,488 7,699
FPC:pay_refund (avm) 26,227 N/A N/A 147,488 7,429 (+1%)
Benchmarking:create_note 1,344 11,731 170 (+1%) N/A N/A
SchnorrAccount:verify_private_authwit 1,280 11,731 27.7 (+1%) N/A N/A
Token:unshield 1,376 11,731 756 (+1%) N/A N/A
FPC:fee_entrypoint_private 1,376 11,731 993 N/A N/A

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
GasToken:_increase_public_balance 93.2 8,139
GasToken:set_portal 10.3 (+5%) 2,362
Token:constructor 120 (+2%) 32,398 (+4%)
FPC:constructor 94.0 25,186 (+5%)
GasToken:mint_public 77.3 (-2%) 6,150
Token:mint_public 82.0 (-7%) 11,720
Token:assert_minter_and_mint 86.3 (-1%) 8,028
AuthRegistry:set_authorized 7.60 (-7%) 4,537
FPC:prepare_fee 296 (+7%) 8,812
Token:transfer_public 42.0 (-13%) 49,489 (+4%)
FPC:pay_refund 63.2 (-3%) 12,114
Benchmarking:increment_balance 982 (+1%) 7,450
Token:_increase_public_balance 9.47 (+2%) 8,960
FPC:pay_refund_with_shielded_rebate 140 (+1%) 12,663

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.158 (+6%)

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 16 leaves 64 leaves 128 leaves 256 leaves 512 leaves 1024 leaves
batch_insert_into_append_only_tree_16_depth_ms 2.16 (+1%) 3.87 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.112 0.109 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 11.0 (-1%) 17.7 30.5 (+2%) 59.7 (-1%) 111 (+3%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 287 543 1,055
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.105 (-1%) 0.102 0.0993 (+2%) 0.103 0.100 (+3%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 14.0 25.3 (-2%) 43.3 (+3%) 83.3 157 (+3%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.106 0.102 (-3%) 0.105 (+4%) 0.103 0.100 (+4%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 16.5 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 133 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.105 N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contract classes are registered in the tx.

Metric 0 registered classes 1 registered classes
tx_size_in_bytes 62,729 664,455

Transaction size based on fee payment method

| Metric | |
| - | |

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.

2 participants