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

perf(trie): hashed state from revert range #6485

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

rkrasiuk
Copy link
Member

@rkrasiuk rkrasiuk commented Feb 8, 2024

Description

  • Avoid hashing account addresses on each changeset occurrence, only hash final addresses instead.
  • Construct final account and storage collections from iterator instead of directly inserting into non-preallocated collections.

@rkrasiuk rkrasiuk added C-perf A change motivated by improving speed, memory usage or disk footprint A-trie Related to Merkle Patricia Trie implementation labels Feb 8, 2024
this.storages.insert(keccak256(address), hashed_storage);
}
let hashed_accounts = HashMap::from_iter(
accounts.into_iter().map(|(address, info)| (keccak256(address), info)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

could this benefit from rayon?

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 unsure about exact size yet, so stayed clear of rayon for now

// should be looked up in db or not. For reverts it's a noop since all
// wiped changes had been written as storage reverts.
false,
storage.into_iter().map(|(slot, value)| (keccak256(slot), value)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

could this benefit from rayon?

Copy link
Member

Choose a reason for hiding this comment

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

heavily doubt it

@rkrasiuk rkrasiuk added this pull request to the merge queue Feb 8, 2024
Merged via the queue into main with commit 5ab57bd Feb 8, 2024
29 checks passed
@rkrasiuk rkrasiuk deleted the rkrasiuk/perf-hashed-state-from-revert branch February 8, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trie Related to Merkle Patricia Trie implementation C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants