Profiling Transactions
This guide shows you how to profile Aztec transactions to understand gate counts and identify optimization opportunities.
Prerequisites
azteccommand installed (see installation)aztec-walletinstalled- Aztec contract deployed and ready to test
- Basic understanding of proving and gate counts
Profile with aztec-wallet
Use the profile command instead of send to get detailed gate counts:
# Import test accounts
aztec-wallet import-test-accounts
# Deploy your contract
aztec-wallet deploy MyContractArtifact \
--from accounts:test0 \
--args [CONSTRUCTOR_ARGS] \
-a mycontract
# Profile a function call
aztec-wallet profile my_function \
-ca mycontract \
--args [FUNCTION_ARGS] \
-f accounts:test0
Reading the output
The profile command outputs a per-circuit breakdown:
Per circuit breakdown:
Function name Time Gates Subtotal
--------------------------------------------------------------------------------
- SchnorrAccount:entrypoint 12.34ms 21,724 21,724
- private_kernel_init 23.45ms 45,351 67,075
- MyContract:my_function 15.67ms 31,559 98,634
- private_kernel_inner 34.56ms 78,452 177,086
Total gates: 177,086 (Biggest circuit: private_kernel_inner -> 78,452)
Key metrics:
- Gates: Circuit complexity for each function
- Subtotal: Accumulated gate count
- Time: Execution time per circuit