-
Notifications
You must be signed in to change notification settings - Fork 340
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
accounts-db: Use NoHashHasher in AccountStorageMap
#4822
Conversation
06c3639
to
013b3b1
Compare
Added @roryharr as a reviewer, since he's starting to work on similar things. |
013b3b1
to
ba05292
Compare
I have the same comments as brooks. Other than that, it looks good to me. |
ba05292
to
4e6ceb0
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.
Code looks good to me. Can you please update the PR title since we're not using AHash.
`DashMap` uses SipHash by default. `AccountStorageMap` uses `Slot` as a key and therefore it doesn't have any chance of collisions. We can skip hashing the key entirely.
4e6ceb0
to
6d1a890
Compare
AccountStorageMap
AccountStorageMap
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.
Let's backport to v2.2 too.
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.
lgtm.
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
`DashMap` uses SipHash by default. `AccountStorageMap` uses `Slot` as a key and therefore it doesn't have any chance of collisions. We can skip hashing the key entirely. (cherry picked from commit cd04323)
doesn't this change imply that hashmap is the wrong data structure to use here? |
#4822) (#4920) accounts-db: Use NoHashHasher in `AccountStorageMap` (#4822) `DashMap` uses SipHash by default. `AccountStorageMap` uses `Slot` as a key and therefore it doesn't have any chance of collisions. We can skip hashing the key entirely. (cherry picked from commit cd04323) Co-authored-by: Michal Rostecki <vadorovsky@protonmail.com>
This structure is mostly adding new entries, removing old entries, and doing lookups. We now only have one storage per slot, so we could probably remove the inner Vec. But scanning the vec to find a slot doesn't seem ideal. Maybe an IndexMap would be another option? |
Problem
DashMap
uses SipHash by default.AccountStorageMap
usesSlot
as a key and therefore it doesn't have any chance of collisions.Summary of Changes
We can skip hashing the key entirely.
Ref #4276