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: Brillig pointer codegen and execution #5737

Merged
merged 66 commits into from
Apr 16, 2024
Merged

Conversation

vezenovm
Copy link
Contributor

Resolves noir-lang/noir#3907

This PR builds upon #5709.

These changes do not yet include a Brillig stdlib and removal of the Brillig opcode itself. The generated stdlib Brillig (such as for quotient) is not created in the same manner as other Brillig calls which are generated during SSA. I have decided to leave this for another follow-up where we can actually remove Brillig.

@AztecBot
Copy link
Collaborator

AztecBot commented Apr 12, 2024

Benchmark results

Metrics with a significant change:

  • circuit_simulation_time_in_ms (base-rollup): 16,096 (+30%)
  • circuit_simulation_time_in_ms (merge-rollup): 7.02 (-48%)
  • l2_block_building_time_in_ms (8): 13,268 (+37%)
  • l2_block_building_time_in_ms (32): 51,967 (+37%)
  • l2_block_building_time_in_ms (64): 103,905 (+36%)
  • l2_block_rollup_simulation_time_in_ms (8): 13,044 (+38%)
  • l2_block_rollup_simulation_time_in_ms (32): 51,137 (+37%)
  • l2_block_rollup_simulation_time_in_ms (64): 102,281 (+37%)
  • l2_block_processing_time_in_ms (64): 10,133 (-16%)
  • note_trial_decrypting_time_in_ms (32): 107 (+299%)
  • note_trial_decrypting_time_in_ms (64): 85.5 (+264%)
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.

L2 block published to L1

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

Metric 8 txs 32 txs 64 txs
l1_rollup_calldata_size_in_bytes 772 772 772
l1_rollup_calldata_gas 6,844 (+1%) 6,820 6,844 (+1%)
l1_rollup_execution_gas 587,325 587,301 587,325
l2_block_processing_time_in_ms 1,436 5,341 (+3%) ⚠️ 10,133 (-16%)
note_successful_decrypting_time_in_ms 213 (-2%) 600 (+15%) 969 (+7%)
note_trial_decrypting_time_in_ms 14.2 (-25%) ⚠️ 107 (+299%) ⚠️ 85.5 (+264%)
l2_block_building_time_in_ms ⚠️ 13,268 (+37%) ⚠️ 51,967 (+37%) ⚠️ 103,905 (+36%)
l2_block_rollup_simulation_time_in_ms ⚠️ 13,044 (+38%) ⚠️ 51,137 (+37%) ⚠️ 102,281 (+37%)
l2_block_public_tx_process_time_in_ms 5,672 (+7%) 22,217 (+7%) 44,505 (+7%)

L2 chain processing

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

Metric 5 blocks 10 blocks
node_history_sync_time_in_ms 15,948 (+9%) 29,957 (+4%)
note_history_successful_decrypting_time_in_ms 1,274 (+13%) 2,307 (+4%)
note_history_trial_decrypting_time_in_ms 58.2 (+39%) 75.2 (-5%)
node_database_size_in_bytes 18,706,512 35,106,896
pxe_database_size_in_bytes 29,859 59,414

Circuits stats

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

Circuit circuit_simulation_time_in_ms circuit_input_size_in_bytes circuit_output_size_in_bytes
private-kernel-init 151 (+1%) 44,716 26,424
private-kernel-inner 161 (+4%) 72,199 26,424
private-kernel-ordering 111 (+3%) 51,090 39,297
base-parity 46.2 (-11%) 128 311
root-parity 8.75 (-13%) 1,244 311
base-rollup ⚠️ 16,096 (+30%) 110,820 957
root-rollup 47.0 (-3%) 4,551 821
public-kernel-app-logic 89.0 (+10%) 48,174 40,933
public-kernel-tail 123 (+2%) 59,635 (+11%) 7,385
merge-rollup ⚠️ 7.02 (-48%) 2,760 957
public-kernel-teardown 76.4 (-2%) 48,151 40,933
public-kernel-setup 75.5 (-3%) 48,151 40,933

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 512 leaves 1024 leaves 2048 leaves 4096 leaves 32 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.8 (-2%) 17.5 (-2%) N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.6 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.631 (-2%) 0.541 (-2%) N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 50.6 (-2%) 80.3 (-4%) 261 501 979 1,940 (-5%) N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 96.0 159 543 1,055 2,079 4,127 N/A
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.520 (-2%) 0.495 (-4%) 0.475 0.468 0.465 0.465 (-4%) N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.8 (-1%) 119 (-2%) 375 738 1,456 2,904 (-1%) N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 105 207 691 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.531 0.535 (-2%) 0.512 0.508 0.506 0.507 (-1%) N/A
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A N/A N/A N/A N/A 67.0 (-1%)
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A N/A N/A N/A N/A N/A 109
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A N/A N/A N/A N/A N/A 0.587 (-1%)

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 41,028 528,889

Transaction size based on fee payment method

Metric native fee payment method fpc_public fee payment method fpc_private fee payment method
tx_with_fee_size_in_bytes 905 1,161 1,377

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes 2 new note hashes
tx_pxe_processing_time_ms 1,167 (+1%) 794 (+1%) 3,260 (-4%)
Metric 1 public data writes 2 public data writes 3 public data writes 4 public data writes 5 public data writes 8 public data writes
tx_sequencer_processing_time_ms 494 (+9%) 297 (-3%) 786 (-4%) 377 (-4%) 1,302 (-4%) 449 (-3%)

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.

Consider introducing BrilligFunctionPointer into ACIR
5 participants