AztecProtocol / aztec-packages

Apache License 2.0
207 stars 238 forks source link

feat: Speed up transaction execution #10172

Open PhilWindle opened 1 day ago

PhilWindle commented 1 day ago

This PR make a number of optimisation related to the speed up of transaction execution. Namely:

  1. We don't re-initialise the instruction set mapping with each instruction decode.
  2. We now compute public bytecode commitments at the point of receiving a contract and persist them, meaning they don't need to be computed at the point of execution.
  3. We only store and iterate opcode and program counter tally information when in debug.
  4. Function names are also cached at the point contract artifacts are shared with the node.
  5. World state status summary and previous block archive roots are cached to reduce the impact on the world state DB whilst execution is taking place.
github-actions[bot] commented 11 hours ago

Changes to public function bytecode sizes

Generated at commit: 32e67a42ce7e3568a6074432fcaba0fc0af9bde6, compared to commit: a9f3b5f6e7e5bc9d4bc9c0600b492a5e0cd2c1d9

๐Ÿงพ Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
DocsExample::public_dispatch +476 โŒ +11.23%

Full diff report ๐Ÿ‘‡
| Program | Bytecode size in bytes (+/-) | % | |:-|-:|-:| | **DocsExample::public_dispatch** | 4,716 (+476) | **+11.23%** |
github-actions[bot] commented 11 hours ago

Changes to circuit sizes

Generated at commit: 32e67a42ce7e3568a6074432fcaba0fc0af9bde6, compared to commit: a9f3b5f6e7e5bc9d4bc9c0600b492a5e0cd2c1d9

๐Ÿงพ Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_base_private +17,511 โŒ +9.72% +688,769 โŒ +34.97%
rollup_base_public +32,952 โŒ +7.96% +710,141 โŒ +21.60%
rollup_merge +1,381 โŒ +67.76% +7,842 โŒ +0.43%
rollup_block_merge -3,013 โœ… -20.06% -43,278 โœ… -2.28%
rollup_root -3,013 โœ… -20.08% -43,278 โœ… -2.28%
rollup_block_root_empty -576 โœ… -85.97% -576 โœ… -16.61%
rollup_block_root -539,886 โœ… -99.18% -1,398,367 โœ… -33.79%

Full diff report ๐Ÿ‘‡
| Program | ACIR opcodes (+/-) | % | Circuit size (+/-) | % | |:-|-:|-:|-:|-:| | **rollup_base_private** | 197,673 (+17,511) | **+9.72%** | 2,658,579 (+688,769) | **+34.97%** | | **rollup_base_public** | 447,125 (+32,952) | **+7.96%** | 3,997,443 (+710,141) | **+21.60%** | | **rollup_merge** | 3,419 (+1,381) | **+67.76%** | 1,827,046 (+7,842) | **+0.43%** | | **rollup_block_merge** | 12,009 (-3,013) | **-20.06%** | 1,858,524 (-43,278) | **-2.28%** | | **rollup_root** | 11,993 (-3,013) | **-20.08%** | 1,858,510 (-43,278) | **-2.28%** | | **rollup_block_root_empty** | 94 (-576) | **-85.97%** | 2,891 (-576) | **-16.61%** | | **rollup_block_root** | 4,489 (-539,886) | **-99.18%** | 2,739,652 (-1,398,367) | **-33.79%** |