Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(perf): Simplify poseidon2 algorithm (noir-lang#5811)
# Description ## Problem\* Resolves <!-- Link to GitHub Issue --> Optimizations found while looking exploring other Brillig opts. ## Summary\* There are a couple optimizations here: 1. I noticed that we loop over the cache and do some resetting inside of `squeeze` of `Poseidon2`. However, we our `Hasher` always creates a fresh Poseidon2 object so it seems unnecessary to reset the cache in this way. In Brillig this leads to an extra loop that is essentially unused and blows up the code size of any programs using poseidon in an unconstrained environment. 2. We were writing into a `result` array and returning it from `perform_duplex`. This result was unused inside of `absorb` and we can directly access `self.state` inside of `squeeze`. I no longer return anything from `perform_duplex`. ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information