Skip to content

Conversation

@tcoratger
Copy link
Contributor

@tcoratger tcoratger commented Nov 21, 2025

Related #10

We are switching to 128 bits and made an optimization by not relying on big integers but for now we keep the issue opened since we need more investigations to know if we will switch to 256 bits or not.

Benchmarks after this PR are:

Benchmarking Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- gen: Warming up for 3Benchmarking Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- gen: Collecting 10 saPoseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- gen
                        time:   [6.4355 ms 6.6207 ms 6.8828 ms]
                        change: [−25.552% −22.650% −19.475%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 10 measurements (10.00%)
  1 (10.00%) high severe
Benchmarking Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- sign: Warming up for Benchmarking Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- sign: Collecting 100 Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- sign
                        time:   [639.38 µs 648.98 µs 658.74 µs]
                        change: [−5.0963% −2.9650% −0.8160%] (p = 0.01 < 0.05)
                        Change within noise threshold.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
Benchmarking Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- verify: Warming up foBenchmarking Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- verify: Collecting 10Poseidon: Top Level TS, Lifetime 2^8, Activation 2^18, Dimension 64, Base 8/- verify
                        time:   [193.45 µs 194.40 µs 195.73 µs]
                        change: [+0.5447% +1.0625% +1.8188%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 11 outliers among 100 measurements (11.00%)
  5 (5.00%) high mild
  6 (6.00%) high severe

Even if we base from 64 bits to 128, it seems better because we don't rely anymore on big integers which are heavy due to vector allocations and heavy operations, so this is a good news that we increase security while improving performances.

Copy link
Contributor

@b-wagn b-wagn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@tcoratger tcoratger changed the title prf: optimize get_domain_element and get_randomness prf: remove small statistical bias in PRF output and speedup Nov 24, 2025
@tcoratger tcoratger merged commit 857b670 into leanEthereum:main Nov 25, 2025
2 checks passed
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