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
Refactor Trie hasher using onRoot flag #1840
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blukat29
requested review from
aidan-kwon,
ethan-kr and
jeongkyun-oh
as code owners
May 9, 2023 08:11
blukat29
changed the title
Refactor Trie hasher using parallel flag
Refactor Trie hasher using onRoot flag
May 11, 2023
blukat29
force-pushed
the
refactor-trie-hasher
branch
from
May 11, 2023 09:16
8f5678b
to
3c17660
Compare
ethan-kr
reviewed
May 16, 2023
ethan-kr
previously approved these changes
May 16, 2023
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.
I made a comment, but there is no disagreement, so I approve it.
jeongkyun-oh
approved these changes
May 18, 2023
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
@ethan-kr PTAL :) |
aidan-kwon
approved these changes
May 24, 2023
aidan-kwon
approved these changes
May 24, 2023
ethan-kr
approved these changes
May 24, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
De-duplicate code in the trie hasher (storage/statedb/hasher.go).
hash()
+hashChildren()
hashRoot()
+hashChildrenFromRoot()
onRoot
argument switches multi-threading.hashNode(..., onRoot)
+hashChildren(..., onRoot)
runs multi-threaded if onRoot == true.hash(...) = hashNode(..., onRoot=false)
hashRoot(...) = hashNode(..., onRoot=true)
Types of changes
Checklist
$ make test
)Related issues
Further comments
Benchmark results show that this PR does not affect hashing performance (on Apple M1 Max 10-core)