Skip to content
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

optimize indexed attestation validation #8941

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tbenr
Copy link
Contributor

@tbenr tbenr commented Dec 19, 2024

Noticed a potential optimization we can have when we validate IndexedAttestations

  • we can preallocate the array to the size we expect
  • we can do the sorting check while retrieving the public keys

test run on a very recent mainnet state with an >500 aggregated indexed attestation

407MB vs 1.17GB of Memory allocations

30% faster

Benchmark                                                          Mode  Cnt   Score   Error   Units
IndexedAttestationValidationBenchmark.validateIndexedAttestation  thrpt   25  89.007 ± 1.200  ops/ms
Benchmark                                                          Mode  Cnt    Score   Error   Units
IndexedAttestationValidationBenchmark.validateIndexedAttestation  thrpt   25  116.165 ± 5.730  ops/ms

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

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.

1 participant