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: reduce max read requests #7260

Closed
wants to merge 2 commits into from
Closed

Conversation

dbanks12
Copy link
Collaborator

@dbanks12 dbanks12 commented Jul 1, 2024

No description provided.

@dbanks12 dbanks12 changed the title chore: reduce max read requests chore: reduce max read requests Jul 1, 2024
Copy link
Collaborator Author

dbanks12 commented Jul 1, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @dbanks12 and the rest of your teammates on Graphite Graphite

@AztecBot
Copy link
Collaborator

AztecBot commented Jul 1, 2024

Benchmark results

Metrics with a significant change:

  • app_circuit_witness_generation_time_in_ms (Token:transfer): 1,786 (-38%)
  • app_circuit_witness_generation_time_in_ms (Token:unshield): 1,535 (-43%)
  • app_circuit_witness_generation_time_in_ms (FPC:fee_entrypoint_private): 2,122 (-39%)
  • protocol_circuit_simulation_time_in_ms (base-rollup): 6,551 (-17%)
  • protocol_circuit_simulation_time_in_ms (public-kernel-app-logic): 501 (-16%)
  • protocol_circuit_simulation_time_in_ms (public-kernel-tail): 1,148 (-19%)
  • protocol_circuit_simulation_time_in_ms (private-kernel-reset-small): 467 (-16%)
  • protocol_circuit_input_size_in_bytes (public-kernel-tail): 399,014 (-22%)
  • protocol_circuit_output_size_in_bytes (private-kernel-init): 54,134 (-19%)
  • protocol_circuit_output_size_in_bytes (private-kernel-inner): 54,134 (-19%)
  • protocol_circuit_output_size_in_bytes (private-kernel-reset-small): 54,134 (-19%)
  • avm_simulation_time_ms (Token:mint_public): 505 (+598%)
  • avm_simulation_time_ms (Token:assert_minter_and_mint): 55.5 (-75%)
  • avm_simulation_time_ms (Token:transfer_public): 44.6 (-39%)
  • avm_simulation_time_ms (Benchmarking:increment_balance): 2,198 (-17%)
  • avm_simulation_time_ms (FPC:pay_refund_with_shielded_rebate): 116 (-36%)
  • app_circuit_proving_time_in_ms (Token:transfer): 12,735 (-44%)
  • app_circuit_size_in_gates (Token:transfer): 524,288 (-50%)
  • protocol_circuit_witness_generation_time_in_ms (private-kernel-init): 387 (-16%)
  • protocol_circuit_witness_generation_time_in_ms (private-kernel-inner): 806 (-25%)
  • protocol_circuit_witness_generation_time_in_ms (private-kernel-reset-small): 1,081 (-45%)
  • protocol_circuit_witness_generation_time_in_ms (private-kernel-tail): 2,134 (+21%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-setup): 2,454 (-35%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-app-logic): 3,422 (-28%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-teardown): 3,473 (-29%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-tail): 25,368 (-35%)
  • protocol_circuit_proving_time_in_ms (private-kernel-reset-small): 27,873 (-42%)
  • protocol_circuit_proving_time_in_ms (private-kernel-tail-to-public): 51,828 (-46%)
  • protocol_circuit_proof_size_in_bytes (private-kernel-init): 73,920 (-20%)
  • protocol_circuit_proof_size_in_bytes (private-kernel-inner): 73,920 (-20%)
  • protocol_circuit_proof_size_in_bytes (private-kernel-reset-small): 73,920 (-20%)
  • protocol_circuit_size_in_gates (private-kernel-reset-small): 1,048,576 (-50%)
  • protocol_circuit_size_in_gates (private-kernel-tail-to-public): 2,097,152 (-50%)
  • protocol_circuit_num_public_inputs (private-kernel-init): 2,243 (-20%)
  • protocol_circuit_num_public_inputs (private-kernel-inner): 2,243 (-20%)
  • protocol_circuit_num_public_inputs (private-kernel-reset-small): 2,243 (-20%)
  • l2_block_building_time_in_ms (4): 20,835 (-21%)
  • l2_block_building_time_in_ms (16): 81,710 (-21%)
  • l2_block_rollup_simulation_time_in_ms (4): 20,835 (-21%)
  • l2_block_rollup_simulation_time_in_ms (16): 81,710 (-21%)
  • l2_block_public_tx_process_time_in_ms (4): 17,839 (-21%)
  • l2_block_public_tx_process_time_in_ms (8): 38,567 (-16%)
  • l2_block_public_tx_process_time_in_ms (16): 78,549 (-21%)
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_30_ms 11,701 (-3%) 3,155 (-2%) 1,683 (-9%) 1,552 (-4%) 1,560
proof_construction_time_sha256_100_ms 43,752 (-3%) 11,748 (-2%) 5,441 (-2%) 5,389 (-2%) 5,356 (-2%)
proof_construction_time_poseidon_hash_ms 78.0 (-2%) 34.0 (-3%) 34.0 (-3%) 58.0 (-2%) 88.0
proof_construction_time_poseidon_hash_30_ms 1,516 (-3%) 415 (-2%) 201 (-1%) 230 (-1%) 267 (-1%)
proof_construction_time_poseidon_hash_100_ms 5,741 (-3%) 1,560 (-2%) 722 (-2%) 767 (-2%) 794 (-2%)

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 1,412 1,412 1,412
l1_rollup_calldata_gas 9,464 9,470 9,476
l1_rollup_execution_gas 611,203 611,360 611,517
l2_block_processing_time_in_ms 757 (-3%) 1,419 2,724 (-3%)
l2_block_building_time_in_ms ⚠️ 20,835 (-21%) 41,768 (-15%) ⚠️ 81,710 (-21%)
l2_block_rollup_simulation_time_in_ms ⚠️ 20,835 (-21%) 41,768 (-15%) ⚠️ 81,710 (-21%)
l2_block_public_tx_process_time_in_ms ⚠️ 17,839 (-21%) ⚠️ 38,567 (-16%) ⚠️ 78,549 (-21%)

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 7,050 9,924
node_database_size_in_bytes 12,218,448 16,183,376
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 proving_time_in_ms input_size_in_bytes output_size_in_bytes proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 102 (-12%) ⚠️ 387 (-16%) 12,983 (-2%) 19,482 (-6%) ⚠️ 54,134 (-19%) ⚠️ 73,920 (-20%) ⚠️ 2,243 (-20%) 524,288
private-kernel-inner 308 (-15%) ⚠️ 806 (-25%) 51,524 (+6%) 80,694 (-15%) ⚠️ 54,134 (-19%) ⚠️ 73,920 (-20%) ⚠️ 2,243 (-20%) 2,097,152
private-kernel-tail 277 (-9%) ⚠️ 2,134 (+21%) 47,432 (-3%) 86,065 (-13%) 62,057 (-13%) 14,912 399 2,097,152
base-parity 6.14 (-2%) 1,544 (-15%) 2,637 (-7%) 128 64.0 2,208 2.00 131,072
root-parity 48.9 (-3%) 70.0 (-7%) 40,913 (-1%) 27,100 64.0 2,720 18.0 2,097,152
base-rollup ⚠️ 6,551 (-17%) 5,035 (+1%) 93,116 (+9%) 170,330 728 3,648 47.0 4,194,304
root-rollup 110 (-2%) 80.2 (-13%) 23,002 (-3%) 25,253 620 3,456 41.0 1,048,576
public-kernel-setup 545 (-15%) ⚠️ 2,454 (-35%) 42,626 (-6%) 102,121 (-13%) 80,278 (-14%) 106,912 (-15%) 3,274 (-15%) 2,097,152
public-kernel-app-logic ⚠️ 501 (-16%) ⚠️ 3,422 (-28%) 45,213 (-7%) 102,121 (-13%) 80,278 (-14%) 106,912 (-15%) 3,274 (-15%) 2,097,152
public-kernel-tail ⚠️ 1,148 (-19%) ⚠️ 25,368 (-35%) 180,507 (-3%) ⚠️ 399,014 (-22%) 10,014 14,912 399 8,388,608
private-kernel-reset-small ⚠️ 467 (-16%) ⚠️ 1,081 (-45%) ⚠️ 27,873 (-42%) 109,233 (-11%) ⚠️ 54,134 (-19%) ⚠️ 73,920 (-20%) ⚠️ 2,243 (-20%) ⚠️ 1,048,576 (-50%)
public-kernel-teardown 495 (-14%) ⚠️ 3,473 (-29%) 44,325 (-8%) 102,121 (-13%) 80,278 (-14%) 106,912 (-15%) 3,274 (-15%) 2,097,152
merge-rollup 29.3 (-2%) N/A N/A 16,486 728 N/A N/A N/A
private-kernel-tail-to-public N/A 6,716 (-3%) ⚠️ 51,828 (-46%) N/A N/A 106,912 (-15%) 3,274 (-15%) ⚠️ 2,097,152 (-50%)

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 size_in_gates num_public_inputs
ContractClassRegisterer:register 1,344 8,792 (-12%) 406 (-2%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 8,792 (-12%) 38.7 (-3%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 8,792 (-12%) 1,186 (-10%) N/A N/A N/A N/A
GasToken:deploy 1,376 8,792 (-12%) 898 (-7%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 8,792 (-12%) 488 (-2%) N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 8,792 (-12%) 1,621 (-14%) 14,720 (-12%) 55,064 (-1%) 2,097,152 393 (-14%)
Token:privately_mint_private_note 1,280 8,792 (-12%) 623 (-3%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 8,792 (-12%) 269 (-12%) 14,720 (-12%) 12,216 (+6%) 524,288 393 (-14%)
Token:transfer 1,312 8,792 (-12%) ⚠️ 1,786 (-38%) 14,720 (-12%) ⚠️ 12,735 (-44%) ⚠️ 524,288 (-50%) 393 (-14%)
AuthRegistry:set_authorized (avm) 19,226 (-8%) N/A N/A 91,264 (-3%) 1,392 (-2%) N/A N/A
FPC:prepare_fee (avm) 26,668 (-6%) N/A N/A 91,328 (-3%) 2,961 (-7%) N/A N/A
Token:transfer_public (avm) 42,884 (-4%) N/A N/A 91,328 (-3%) 3,958 (-2%) N/A N/A
AuthRegistry:consume (avm) 33,104 (-5%) N/A N/A 91,264 (-3%) 2,935 (-2%) N/A N/A
FPC:pay_refund (avm) 36,833 (-4%) N/A N/A 91,296 (-3%) 23,367 (-2%) N/A N/A
Benchmarking:create_note 1,344 8,792 (-12%) 478 (-2%) N/A N/A N/A N/A
SchnorrAccount:verify_private_authwit 1,280 8,792 (-12%) 71.3 (-1%) N/A N/A N/A N/A
Token:unshield 1,376 8,792 (-12%) ⚠️ 1,535 (-43%) N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 8,792 (-12%) ⚠️ 2,122 (-39%) N/A N/A 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 68.8 (-15%) 13,790
GasToken:set_portal 18.6 (-1%) 3,305
Token:constructor 91.5 (-8%) 23,658
FPC:constructor 63.0 (-1%) 13,592
GasToken:mint_public 52.2 (+2%) 10,158
Token:mint_public ⚠️ 505 (+598%) 19,000
Token:assert_minter_and_mint ⚠️ 55.5 (-75%) 12,891
AuthRegistry:set_authorized 32.2 (-3%) 7,812
FPC:prepare_fee 110 (-17%) 15,062
Token:transfer_public ⚠️ 44.6 (-39%) 31,184
FPC:pay_refund 130 (-12%) 25,260
Benchmarking:increment_balance ⚠️ 2,198 (-17%) 15,233
Token:_increase_public_balance 55.6 (-1%) 14,972
FPC:pay_refund_with_shielded_rebate ⚠️ 116 (-36%) 26,347

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.155 (-4%)

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 10.3 (-2%) 16.7 (-2%) 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.598 (-2%) 0.512 (-2%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.2 (-2%) 75.9 (-2%) 131 (-4%) 246 469 (-4%)
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.492 (-2%) 0.466 (-2%) 0.451 (-4%) 0.445 0.438 (-4%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.4 (-2%) 112 (-2%) 183 (-4%) 354 691 (-4%)
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.502 (-2%) 0.502 (-2%) 0.484 (-4%) 0.479 0.474 (-4%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 72.8 (-1%) 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.518 (-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 74,057 (-14%) 667,850

Transaction size based on fee payment method

| Metric | |
| - | |

Copy link
Contributor

@jeanmon jeanmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from db/pil-constants-gen to master July 2, 2024 10:37
@dbanks12 dbanks12 closed this Jul 2, 2024
@dbanks12 dbanks12 deleted the db/max-xxx-reduction branch November 21, 2024 03:32
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.

5 participants