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(tree): re-use intermediate nodes #9836

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

rkrasiuk
Copy link
Member

Description

Computation of overlay root with cached intermediate nodes. Will likely be broken down into smaller PRs.

@rkrasiuk rkrasiuk changed the title feat(trie): root with intermediate nodes feat(engine): re-use intermediate nodes Jul 26, 2024
@rkrasiuk rkrasiuk changed the title feat(engine): re-use intermediate nodes feat(tree): re-use intermediate nodes Jul 26, 2024
@rkrasiuk rkrasiuk added C-perf A change motivated by improving speed, memory usage or disk footprint A-blockchain-tree Related to sidechains, reorgs and pending blocks labels Jul 26, 2024
@rkrasiuk rkrasiuk force-pushed the rkrasiuk/overlay-root-with-intermediate-nodes branch from 6564040 to 29a4823 Compare July 29, 2024 14:05
@rkrasiuk rkrasiuk marked this pull request as ready for review July 29, 2024 14:28
@rkrasiuk rkrasiuk added the A-trie Related to Merkle Patricia Trie implementation label Jul 29, 2024
@rkrasiuk rkrasiuk changed the title feat(tree): re-use intermediate nodes perf(tree): re-use intermediate nodes Jul 29, 2024
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines 27 to 44
let mut trie_updates = TrieUpdates::default();
for block in &in_memory {
hashed_post_state.extend(block.hashed_state.as_ref().clone());
trie_updates.extend(block.trie.as_ref().clone());
}
Copy link
Member

Choose a reason for hiding this comment

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

can avoid the clones here?

Copy link
Member

Choose a reason for hiding this comment

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

we can use Arc around the trie update and hashed post state in the ExecutedBlock type

@rkrasiuk rkrasiuk requested a review from onbjerg as a code owner August 1, 2024 09:07
@rkrasiuk rkrasiuk marked this pull request as draft August 1, 2024 09:08
@rkrasiuk rkrasiuk force-pushed the rkrasiuk/overlay-root-with-intermediate-nodes branch from 973a602 to 318c938 Compare August 7, 2024 16:23
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

only have questions re todos

crates/trie/db/src/state.rs Outdated Show resolved Hide resolved
@rkrasiuk rkrasiuk force-pushed the rkrasiuk/overlay-root-with-intermediate-nodes branch from 43ee877 to ea67709 Compare August 13, 2024 05:48
@rkrasiuk rkrasiuk marked this pull request as ready for review August 13, 2024 18:27
@rkrasiuk rkrasiuk added this pull request to the merge queue Aug 13, 2024
Merged via the queue into main with commit ac3d62b Aug 13, 2024
34 checks passed
@rkrasiuk rkrasiuk deleted the rkrasiuk/overlay-root-with-intermediate-nodes branch August 13, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks 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.

5 participants