Skip to content

Conversation

feltroidprime
Copy link

@feltroidprime feltroidprime commented Sep 8, 2023

This gives ~7x improvement by not using numpy for vectors/matrices, using native python pow function, and using the mds matrix directly instead of matrix multiplication, taking advantage of the small constants.

This would allow faster trace generation when using cairo-run for programs that uses intensively the Poseidon builtin since the permutation is used in the builtin runner.

Quite a few interesting programs could benefit from it. :)

For ~100k hashes on a i7-12700h (one core), it takes around 13 seconds instead of 90.
The only counterpart is that it is removing generality over the Mds Matrix, but it's not really a problem in our context.


This change is Reviewable

@0xLucqs
Copy link

0xLucqs commented Feb 5, 2024

Fyi a slightly different version of this will be in 0.13.1. Thanks for the contrib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants