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 compilation by breaking up acir types.hpp #6816

Merged
merged 10 commits into from
Jun 3, 2024

Conversation

ludamad
Copy link
Collaborator

@ludamad ludamad commented Jun 1, 2024

This reduces wasm compilation by 15% aggregate and all release targets by 9% aggregate (note: not the same as wall time because that depends on bottlenecks, looking at you AVM)

before:

Compilation (367 times):
Parsing (frontend): 1677.6 s
Codegen & opts (backend): 765.9 s

after:
Compilation (365 times):
Parsing (frontend): 1412.3 s
Codegen & opts (backend): 675.1 s

Misc changes:

  • minor cleanup of using namespace bb and a few typedefs

@@ -248,7 +248,7 @@ jobs:
+bench-comment

bb-gcc:
needs: [build, changes]
needs: [setup, changes]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This wasn't running (luckily it passes so we're ok)

@AztecBot
Copy link
Collaborator

AztecBot commented Jun 2, 2024

Benchmark results

Metrics with a significant change:

  • protocol_circuit_witness_generation_time_in_ms (private-kernel-init): 563 (+17%)
  • protocol_circuit_witness_generation_time_in_ms (private-kernel-tail-to-public): 8,254 (-16%)
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,782 (+2%) 1,568 (+2%) 701 758 (+2%) 779 (+1%)
proof_construction_time_sha256_30_ms 12,044 (+3%) 3,182 (+1%) 1,412 1,435 1,465
proof_construction_time_sha256_100_ms 45,543 (+2%) 12,228 (+2%) 5,670 5,540 5,588 (+2%)
proof_construction_time_poseidon_hash_ms 79.0 (+1%) 34.0 34.0 58.0 (+2%) 88.0
proof_construction_time_poseidon_hash_30_ms 1,539 (+2%) 423 (+2%) 203 (+1%) 226 271
proof_construction_time_poseidon_hash_100_ms 5,798 (+2%) 1,573 (+1%) 725 783 794

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 1,412 1,412 1,412
l1_rollup_calldata_gas 9,452 9,440 9,464
l1_rollup_execution_gas 607,988 607,976 608,000
l2_block_processing_time_in_ms 1,288 4,822 9,586
l2_block_building_time_in_ms 44,198 175,090 349,731
l2_block_rollup_simulation_time_in_ms 44,003 174,362 348,296
l2_block_public_tx_process_time_in_ms 40,784 171,048 344,925

L2 chain processing

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

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 9,407 (+1%) 14,433 (+1%)
node_database_size_in_bytes 14,499,920 21,332,048
pxe_database_size_in_bytes 18,071 29,868

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 136 (-1%) ⚠️ 563 (+17%) 12,667 (-6%) 20,634 64,614 89,536 2,731 524,288
private-kernel-inner 406 940 (-11%) 49,696 (-13%) 92,326 64,614 89,536 2,731 2,097,152
private-kernel-tail 585 2,659 (-2%) 51,516 (-15%) 96,545 77,732 11,648 297 2,097,152
base-parity 6.43 1,685 2,712 (-2%) 128 64.0 2,208 2.00 131,072
root-parity 49.1 66.6 (-1%) 39,460 (-9%) 27,100 64.0 2,720 18.0 2,097,152
base-rollup 12,054 (+2%) 2,377 (-6%) 77,986 (-10%) 119,738 756 3,648 47.0 4,194,304
root-rollup 109 81.2 (-1%) 23,737 (-4%) 25,309 620 3,456 41.0 1,048,576
public-kernel-app-logic 571 (+1%) 3,474 (-8%) 43,856 (-10%) 108,073 86,550 116,768 3,582 2,097,152
public-kernel-tail 1,126 (+1%) 23,396 (-6%) 175,390 (-14%) 403,238 7,646 11,648 297 8,388,608
private-kernel-reset-small 591 1,918 (-2%) 45,315 (-12%) 120,737 64,614 89,536 2,731 2,097,152
public-kernel-setup 657 (-1%) 2,733 (-6%) 42,786 (-7%) 108,073 86,550 116,768 3,582 2,097,152
public-kernel-teardown 565 (-2%) 3,523 (-7%) 45,092 (-7%) 108,073 86,550 116,768 3,582 2,097,152
merge-rollup 29.2 (+2%) N/A N/A 16,542 756 N/A N/A N/A
private-kernel-tail-to-public N/A ⚠️ 8,254 (-16%) 103,971 (-9%) N/A N/A 116,768 3,582 4,194,304

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 9,944 457 (-2%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 40.9 (-1%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,752 N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,421 N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,739 16,768 55,430 (-9%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,556 (-2%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 1,030 (-2%) 16,768 10,946 (-6%) 524,288 457
Token:transfer 1,376 9,944 5,271 (-1%) 16,768 53,415 (-12%) 2,097,152 457
Benchmarking:create_note 1,344 9,944 1,388 N/A N/A N/A N/A
SchnorrAccount:spend_private_authwit 1,280 9,944 77.3 (+1%) N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,933 (+1%) N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,806 (+1%) N/A N/A N/A N/A

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.4 (-1%) 17.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.7 31.8 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.600 (-1%) 0.517 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 48.4 76.5 246 (-1%) 475 (+1%) 929 (-1%) 1,841 (-1%) N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 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.494 0.472 0.446 (-1%) 0.444 (+1%) 0.440 (-1%) 0.439 (-1%) N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 58.1 112 (-1%) 356 (-1%) 699 (+1%) 1,386 (-1%) 2,759 (-1%) N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 106 208 692 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.502 0.503 0.483 (-1%) 0.480 (+1%) 0.478 (-1%) 0.479 (-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 62.6
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 107
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.553

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 84,053 665,267

Transaction size based on fee payment method

| Metric | |
| - | |

Copy link
Contributor

@codygunton codygunton left a comment

Choose a reason for hiding this comment

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

TYSM

@codygunton codygunton merged commit d9f7da3 into master Jun 3, 2024
89 checks passed
@codygunton codygunton deleted the ad/bust-acir-types-hpp branch June 3, 2024 09:00
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