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

feat: Extract slice operations to reusable procedures #8496

Closed
wants to merge 16 commits into from

Conversation

sirasistant
Copy link
Collaborator

Calling the same slice operation more than once won't duplicate the bytecode anymore, will just jump to it.

@TomAFrench
Copy link
Member

Can you make this PR in the Noir repo? There shouldn't be a need to do this in aztec-packages.

@sirasistant
Copy link
Collaborator Author

True, will port it over! I'm going to trigger a sync to the noir repo first

@sirasistant
Copy link
Collaborator Author

It's here noir-lang/noir#6001

@AztecBot
Copy link
Collaborator

Benchmark results

Metrics with a significant change:

  • public_db_access_time_ms (get-nullifier-index): 0.337 (+108%)
  • avm_simulation_time_ms (FeeJuice:_increase_public_balance): 43.7 (-68%)
  • avm_simulation_time_ms (Token:mint_public): 253 (+483%)
  • avm_simulation_time_ms (Token:assert_minter_and_mint): 43.0 (-84%)
  • avm_simulation_time_ms (Token:transfer_public): 13.7 (-37%)
  • l2_block_processing_time_in_ms (4): 257 (-17%)
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,763 1,553 (-1%) 714 777 (+3%) 776 (-2%)
proof_construction_time_sha256_30_ms 11,976 3,182 (+1%) 1,423 (+1%) 1,450 1,488 (+1%)
proof_construction_time_sha256_100_ms 44,294 (-1%) 11,895 (-1%) 5,501 (-10%) 6,261 (+7%) 5,429 (-6%)
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 58.0 88.0 (+1%)
proof_construction_time_poseidon_hash_30_ms 1,531 418 201 225 (-3%) 273 (+1%)
proof_construction_time_poseidon_hash_100_ms 5,677 1,521 681 737 (+2%) 756 (-1%)

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 4,420 7,940 14,948
l1_rollup_calldata_gas 50,344 93,320 178,256
l1_rollup_execution_gas 843,477 1,577,349 3,362,342
l2_block_processing_time_in_ms ⚠️ 257 (-17%) 442 (-7%) 818 (-15%)
l2_block_building_time_in_ms 9,311 18,357 (-1%) 36,699 (-1%)
l2_block_rollup_simulation_time_in_ms 9,310 18,357 (-1%) 36,699 (-1%)
l2_block_public_tx_process_time_in_ms 7,918 16,946 (-1%) 35,250 (-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 3,407 (+3%) 4,223 (+3%)
node_database_size_in_bytes 14,176,496 18,206,960
pxe_database_size_in_bytes 16,258 26,818

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
private-kernel-init 73.9 (-3%) 393 (+4%) 20,975 44,933 N/A
private-kernel-inner 142 (-1%) 712 (+1%) 71,787 45,067 N/A
private-kernel-reset-tiny 342 (-2%) 725 (+3%) 64,273 44,922 N/A
private-kernel-tail 152 (-1%) 135 (+2%) 50,551 57,178 N/A
base-parity 5.60 N/A 160 96.0 N/A
root-parity 35.5 (+1%) N/A 73,964 96.0 N/A
base-rollup 2,139 (-2%) N/A 189,128 664 N/A
block-root-rollup 41.3 N/A 58,217 2,448 N/A
public-kernel-setup 86.7 (-1%) N/A 114,433 79,670 N/A
public-kernel-app-logic 99.3 (-1%) N/A 114,251 79,670 N/A
public-kernel-tail 588 N/A 487,098 16,414 N/A
private-kernel-reset-small 306 (+1%) N/A 66,345 45,629 N/A
private-kernel-tail-to-public 677 (-14%) 622 (+3%) 448,120 1,825 N/A
public-kernel-teardown 86.0 N/A 114,697 79,670 N/A
merge-rollup 20.1 (-1%) N/A 38,182 664 N/A
undefined N/A N/A N/A N/A 98,753 (-6%)

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms
ContractClassRegisterer:register 1,344 11,731 346
ContractInstanceDeployer:deploy 1,408 11,731 18.3 (+1%)
MultiCallEntrypoint:entrypoint 1,920 11,731 423
FeeJuice:deploy 1,376 11,731 393 (-1%)
SchnorrAccount:constructor 1,312 11,731 62.1 (+3%)
SchnorrAccount:entrypoint 2,336 11,731 369
FeeJuice:claim 1,344 11,731 39.4 (+15%)
Token:privately_mint_private_note 1,280 11,731 67.8 (-1%)
FPC:fee_entrypoint_public 1,344 11,731 24.5 (-3%)
Token:transfer 1,312 11,731 211 (-2%)
Benchmarking:create_note 1,344 11,731 74.7
SchnorrAccount:verify_private_authwit 1,280 11,731 26.3
Token:unshield 1,376 11,731 484 (-1%)
FPC:fee_entrypoint_private 1,376 11,731 641 (-3%)

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
FeeJuice:_increase_public_balance ⚠️ 43.7 (-68%) 1,328
FeeJuice:set_portal 11.0 (-27%) 1,274
Token:constructor 253 11,527 (+1%)
FPC:constructor 67.6 (-1%) 8,459
FeeJuice:check_balance 36.0 (+1%) 1,135
Token:mint_public ⚠️ 253 (+483%) 2,413
Token:assert_minter_and_mint ⚠️ 43.0 (-84%) 1,629
AuthRegistry:set_authorized 35.4 (-19%) 567
FPC:prepare_fee 92.0 (+4%) 1,420 (-13%)
Token:transfer_public ⚠️ 13.7 (-37%) 9,335
FPC:pay_refund 38.3 (-17%) 1,952 (-10%)
Benchmarking:increment_balance 999 (-1%) 1,618 (+2%)
Token:_increase_public_balance 36.9 (-2%) 1,305
FPC:pay_refund_with_shielded_rebate 51.8 1,952 (-10%)

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index ⚠️ 0.337 (+108%)

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.17 (+2%) 3.92 (+3%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.7 31.8 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.114 (+3%) 0.110 (+3%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 11.3 (+1%) 17.7 31.0 (+1%) 58.7 115 (-1%)
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.109 (+1%) 0.102 0.101 (+1%) 0.101 0.103 (-1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 14.2 (+1%) 26.0 44.8 (+2%) 82.3 165 (+1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 357 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.109 (+1%) 0.105 (-1%) 0.108 (+3%) 0.101 (-1%) 0.105 (+1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 16.2 (+1%) N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 129 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.107 (+1%) 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 72,417 668,302

Transaction size based on fee payment method

| Metric | |
| - | |

@sirasistant
Copy link
Collaborator Author

Ported here noir-lang/noir#6002

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.

3 participants