noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
871 stars 188 forks source link

fix: avoid duplicating constant arrays #5287

Closed guipublic closed 3 months ago

guipublic commented 3 months ago

Description

Problem*

Resolves #5286

Summary*

Keep track of constant arrays and the array they resolve to in mem2reg, so that another constant array is not created for the same array.

Additional Context

Documentation*

Check one:

PR Checklist*

github-actions[bot] commented 3 months ago

Changes to circuit sizes

Generated at commit: 7dfada018bc7e06bde533f1a46d2eb36db2de670, compared to commit: e1000176a31140b2abd79c47653cbc4bb1a6808a

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

Program ACIR opcodes (+/-) % Circuit size (+/-) %
nested_array_dynamic +43 โŒ +0.98% -616 โœ… -3.88%
nested_array_in_slice +1 โŒ +0.09% -984 โœ… -14.67%

Full diff report ๐Ÿ‘‡
| Program | ACIR opcodes (+/-) | % | Circuit size (+/-) | % | |:-|-:|-:|-:|-:| | **slice_dynamic_index** | 1,322 (+53) | **+4.18%** | 6,855 (-46) | **-0.67%** | | **hashmap** | 209,915 (-84) | **-0.04%** | 397,328 (-3,691) | **-0.92%** | | **nested_array_dynamic** | 4,449 (+43) | **+0.98%** | 15,257 (-616) | **-3.88%** | | **nested_array_in_slice** | 1,095 (+1) | **+0.09%** | 5,723 (-984) | **-14.67%** |