Skip to content

feat!: Internal as a macro - #4898

Merged
TomAFrench merged 11 commits into
masterfrom
palla/internal-as-macro
Mar 5, 2024
Merged

TomAFrench merged 11 commits into
masterfrom
palla/internal-as-macro

Conversation

@spalladino

@spalladino spalladino commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Implement internal functions as a macro. Internal functions are now written with an aztec(internal) decorator as opposed to the internal keyword.

@AztecBot

ghost commented Mar 1, 2024

Copy link
Copy Markdown
Collaborator

Benchmark results

Metrics with a significant change:

  • note_trial_decrypting_time_in_ms (8): 109 (+1267%)
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 245d8012 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 64 txs
l1_rollup_calldata_size_in_bytes 5,700 18,884 36,452
l1_rollup_calldata_gas 66,132 238,964 469,832
l1_rollup_execution_gas 194,080 500,270 909,090
l2_block_processing_time_in_ms 1,184 (-1%) 4,475 (-1%) 8,850 (-1%)
note_successful_decrypting_time_in_ms 199 534 (-1%) 988
note_trial_decrypting_time_in_ms ⚠️ 109 (+1267%) 54.6 (-7%) 121 (-2%)
l2_block_building_time_in_ms 15,847 63,009 125,794
l2_block_rollup_simulation_time_in_ms 12,023 47,978 96,031
l2_block_public_tx_process_time_in_ms 3,794 (+1%) 14,945 29,616 (-1%)

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 14,867 (+6%) 28,141 (+4%)
note_history_successful_decrypting_time_in_ms 1,240 (-1%) 2,420 (+2%)
note_history_trial_decrypting_time_in_ms 93.5 (-19%) 136 (+9%)
node_database_size_in_bytes 18,804,816 35,459,152
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 246 44,736 28,001
private-kernel-ordering 177 52,625 14,627
base-rollup 1,289 177,932 933
root-rollup 71.6 (+2%) 4,192 825
private-kernel-inner 312 (-1%) 73,715 28,001
public-kernel-app-logic 190 (-1%) 32,254 25,379
merge-rollup 5.81 (+1%) 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 64 leaves 128 leaves 512 leaves 1024 leaves 2048 leaves 4096 leaves
batch_insert_into_append_only_tree_16_depth_ms 9.93 (+1%) 10.7 12.5 (-16%) 16.3 22.2 (-19%) 35.3 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 79.0 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.576 (+1%) 0.595 0.531 (-16%) 0.504 (+1%) 0.463 (-18%) 0.440 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 46.0 71.9 230 449 (+1%) 865 (-2%) 1,719
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A N/A N/A N/A 96.0 159 543 1,055 2,079 4,127
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A N/A N/A N/A 0.472 0.444 0.420 0.421 (+1%) 0.412 (-2%) 0.412
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 54.2 106 (-2%) 339 (-1%) 663 (+1%) 1,300 (-1%) 2,592 (-1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A N/A N/A N/A 104 207 691 1,363 2,707 5,395
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A N/A N/A N/A 0.482 0.480 (-1%) 0.457 (-1%) 0.458 (+1%) 0.452 (-1%) 0.452
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A 61.9 (+1%) 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 N/A 109 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 N/A 0.541 (+1%) 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
tx_size_in_bytes 19,179

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes
tx_pxe_processing_time_ms 2,577 1,344
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 0.0294 (+1%) 466

Comment thread noir/noir-repo/aztec_macros/src/lib.rs
@spalladino
spalladino force-pushed the palla/internal-as-macro branch from 1435d81 to e3130fd Compare March 4, 2024 20:35
@spalladino
spalladino marked this pull request as ready for review March 4, 2024 21:44
@AztecBot

ghost commented Mar 4, 2024

Copy link
Copy Markdown
Collaborator

Docs Preview

Hey there! 👋 You can check your preview at https://65e72a6c18b65a236589e8d9--aztec-docs-dev.netlify.app

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, cc @TomAFrench on the frontend changes

@Maddiaa0
Maddiaa0 requested a review from TomAFrench March 5, 2024 09:30
@TomAFrench

ghost commented Mar 5, 2024

Copy link
Copy Markdown
Member

I'm fine with this. We'll probably remove the concept of a function being internal in future and just attach the function's custom attributes into the build artifact, so we don't need to thread knowledge of an aztec concept through the compiler.

Could we follow this up with another PR which makes the same change for the open keyword?

@TomAFrench
TomAFrench enabled auto-merge (squash) March 5, 2024 14:03
@TomAFrench
TomAFrench merged commit 73d640a into master Mar 5, 2024
@TomAFrench
TomAFrench deleted the palla/internal-as-macro branch March 5, 2024 14:30
@Maddiaa0

ghost commented Mar 5, 2024

Copy link
Copy Markdown
Contributor

Could we follow this up with another PR which makes the same change for the open keyword?

it should be quick to remove, the #[aztec(public)] already adds open

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.

4 participants