-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use runtime loops for brillig array initialization (#5243)
# Description ## Problem\* Brillig bytecode size can blowup if your function needs to create a big constant array. This is because the array is initialized with compile-time issued instructions (N STORE instructions where N is the number of items in the array) ## Summary\* This PR will initialize the array with a runtime loop if it's bigger than a minimum size, all the elements are equal and contains no nested arrays. ## Additional Context <details> <summary> This optimization improves bytecode size for some aztec public functions affected by this kind of blowup: </summary> ``` Transpiling function _approve_bridge_and_exit_input_asset_to_L1 on contract Uniswap with size 3165 => 2427 Transpiling function claim_public on contract GasToken with size 3415 => 2395 Transpiling function claim_public on contract TokenBridge with size 3457 => 2437 Transpiling function consume_message_from_arbitrary_sender_public on contract Test with size 1893 => 1135 Transpiling function consume_mint_public_message on contract Test with size 2600 => 1580 Transpiling function emit_unencrypted on contract Test with size 343 => 301 Transpiling function emit_unencrypted_log on contract AvmTest with size 930 => 774 ``` </details> ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
1 parent
6673c8b
commit 0bd22bb
Showing
2 changed files
with
147 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters