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

Keep cooked pubkeys in cache #3122

Merged
merged 1 commit into from
Nov 25, 2021
Merged

Keep cooked pubkeys in cache #3122

merged 1 commit into from
Nov 25, 2021

Conversation

arnetheduck
Copy link
Member

Turning uncompressed pubkeys into cooked ones is fast, but unnecessary -
this should avoid a little work for every signature validation we do by
pre-loading them at startup.

Turning uncompressed pubkeys into cooked ones is fast, but unnecessary -
this should avoid a little work for every signature validation we do by
pre-loading them at startup.
@arnetheduck
Copy link
Member Author

Running block_sim shows a small improvement (a few %) - this is expected because block_sim doesn't really benchmark key loading in any significant way - nonetheless, no loadValid work is faster than fast loadValid work.

@github-actions
Copy link

github-actions bot commented Nov 25, 2021

Unit Test Results

     12 files  ±0     748 suites  ±0   33m 34s ⏱️ -8s
1 467 tests ±0  1 465 ✔️ ±0  2 💤 ±0  0 ±0 
8 936 runs  ±0  8 928 ✔️ ±0  8 💤 ±0  0 ±0 

Results for commit a999b59. ± Comparison against base commit 9c2f43e.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@mratsim mratsim left a comment

Choose a reason for hiding this comment

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

LGTM apart from the confusing name

pubkey*: UncompressedPubKey
withdrawal_credentials*: Eth2Digest

ImmutableValidatorData2* = object
pubkey*: CookedPubKey
withdrawal_credentials*: Eth2Digest
Copy link
Contributor

Choose a reason for hiding this comment

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

The types are hard to distinguish in actual code. Maybe rename ImmutableValidatorCookedData?

Copy link
Member Author

Choose a reason for hiding this comment

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

well, they follow one pattern (variable and type), this would simply be another, equally confusing name - ie either you focus on the cooked:ness, or the db:ness, don't see a clear advantage to either and this is the minimal patch

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm sure that @zah has some advanced framework-based feature up his sleeve to deal with this that would resolve this 2-line problem with a multilayered abstract solution :)

@arnetheduck arnetheduck merged commit f69b272 into unstable Nov 25, 2021
@arnetheduck arnetheduck deleted the load-cookedpubkey branch November 25, 2021 18:41
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