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: disallowing users to specify bb min memory allocation #4570

Closed
wants to merge 1 commit into from

Conversation

signorecello
Copy link
Contributor

Replicating changes in noir-lang/noir#4227

@ludamad
Copy link
Collaborator

ludamad commented Feb 13, 2024

Hmm I get the reasoning for not having it available through Noir where we control the setup tightly, but I could see reasons for having initial memory for deeper hacking - if you are fiddling build stuff differently, you could need more. But I guess you could edit source. @charlielye thoughts?

@AztecBot
Copy link
Collaborator

Benchmark results

Metrics with a significant change:

  • note_successful_decrypting_time_in_ms (8): 315 (-27%)
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.

Values are compared against data from master at commit 9dc05bc3 and shown if the difference exceeds 1%.

L2 block published to L1

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

Metric 8 txs 32 txs 128 txs
l1_rollup_calldata_size_in_bytes 45,956 181,604 724,196
l1_rollup_calldata_gas 227,168 888,764 3,534,668
l1_rollup_execution_gas 320,359 1,007,212 3,755,046
l2_block_processing_time_in_ms 1,194 (+1%) 4,478 17,799 (+1%)
note_successful_decrypting_time_in_ms ⚠️ 315 (-27%) 972 3,658 (+1%)
note_trial_decrypting_time_in_ms 29.1 (-29%) 103 (-1%) 175 (+2%)
l2_block_building_time_in_ms 18,232 72,073 289,458
l2_block_rollup_simulation_time_in_ms 13,537 53,488 215,599
l2_block_public_tx_process_time_in_ms 4,662 18,508 73,604

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,468 (+7%) 30,303 (+8%)
note_history_successful_decrypting_time_in_ms 2,359 (-3%) 4,616 (-2%)
note_history_trial_decrypting_time_in_ms 126 (+24%) 239 (+45%)
node_database_size_in_bytes 17,305,680 33,230,928
pxe_database_size_in_bytes 29,923 59,478

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 327 44,528 25,313
private-kernel-ordering 196 43,633 16,193
base-rollup 1,459 129,774 933
root-rollup 82.4 (-3%) 4,192 729
private-kernel-inner 436 70,819 25,313
public-kernel-private-input 239 33,663 26,945
public-kernel-non-first-iteration 238 33,705 26,945
merge-rollup 7.84 (-2%) 2,712 933

Tree insertion stats

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

Metric 1 leaves 2 leaves 8 leaves 16 leaves 32 leaves 128 leaves 64 leaves 512 leaves 1024 leaves 2048 leaves 8192 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.3 11.3 (+6%) 12.8 (+1%) 17.0 22.9 (-1%) 64.0 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.9 17.5 23.0 31.6 47.0 143 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.595 0.629 (+6%) 0.539 0.526 0.479 (-1%) 0.441 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A N/A N/A N/A 74.4 47.7 239 461 900 (-1%) 3,562 (+1%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A N/A N/A N/A 159 96.0 543 1,055 2,079 8,223
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A N/A N/A N/A 0.460 0.488 0.436 0.431 0.429 (-1%) 0.428
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 104 (-1%) 57.0 350 (-1%) 690 1,362 5,442
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A N/A N/A N/A 197 104 691 1,363 2,707 10,771
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A N/A N/A N/A 0.490 (-1%) 0.498 0.477 0.473 0.471 0.472
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A 57.0 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A 94.1 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A 0.578 N/A N/A N/A N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contracts are deployed in the tx.

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 16,859 39,794

Transaction processing duration by data writes.

Metric 0 new commitments 1 new commitments
tx_pxe_processing_time_ms 551 (-4%) 1,441
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 0.505 (-1%) 574

@signorecello
Copy link
Contributor Author

@TomAFrench

@signorecello signorecello requested review from TomAFrench and charlielye and removed request for TomAFrench February 13, 2024 15:24
@TomAFrench
Copy link
Member

Copying across my concern from the other PR:

my biggest worry is users passing in an invalid initial memory and then raising issues asking why the wasm doesn't start.

I'd agree that bb.js doesn't need to be changed here but I also don't think we need to expose this out to Noir if there's a potential footgun.

As an alternative, ignoring the user input if its below the minimum required memory and just set it to the default value would also be acceptable to me.

@signorecello
Copy link
Contributor Author

Makes sense to me. In that case I'm closing this one and reopening noir-lang/noir#4227. I'm leaving BB as it is while allowing the user to only change max memory in Noir tooling

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.

None yet

4 participants