-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix poseidon hash bottleneck in Mina submodule #1378
Conversation
ea96734
to
bb29f33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This improvement is worthy of a changelog entry imo!
…ails for Poseidon hashing
…e to 'Unreleased' section This change is made to correctly reflect the status of the improvement, as it has not been released yet.
282138b
to
88998ce
Compare
mina: MinaProtocol/mina#14921
bindings: o1-labs/o1js-bindings#237
Summary
When performing a Poseidon hash, the Rust code responsible for performing the update has a bottleneck, primarily due to re-computing its internal parameters every time the function is invoked, as seen in the figure below.
It can be seen that
mina_poseidon::pasta::fp_kimchi::params
takes nearly 50ms, where the total running time of the hash stack trace is 53ms. By using the static version of the params function, we only generate the params once and then reload them every time it's used.The results of the change can be seen in the figure below.
The profile shows that the params have not been generated this time, making the total running time 4ms.
This means we have a 13x speedup on Poseidon hashing 🎉