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 unnecessarily splitting expressions with multiplication terms with a shared term #5291

Closed TomAFrench closed 3 months ago

TomAFrench commented 3 months ago

Description

Problem*

Resolves

Summary*

This PR addresses an issue where we were unnecessarily splitting an expression based on an example which Zac found while working on noir-edwards. We were being overly restrictive and only accepting the case where both witnesses in the multiplication are shared with other terms

Additional Context

Documentation*

Check one:

PR Checklist*

github-actions[bot] commented 3 months ago

Changes to circuit sizes

Generated at commit: 0280a9c70681f8443729e777f6088ad21acd60b5, compared to commit: 3ef36458fef36b2a2f6cf99b35a43339f3721b27

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

Program ACIR opcodes (+/-) % Circuit size (+/-) %
hashmap -4 โœ… -0.00% -4 โœ… -0.00%
regression -3 โœ… -0.86% -3 โœ… -0.08%

Full diff report ๐Ÿ‘‡
| Program | ACIR opcodes (+/-) | % | Circuit size (+/-) | % | |:-|-:|-:|-:|-:| | **hashmap** | 209,911 (-4) | **-0.00%** | 397,324 (-4) | **-0.00%** | | **regression** | 347 (-3) | **-0.86%** | 3,910 (-3) | **-0.08%** |