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(engine): add StateRootTask bench #13212

Merged
merged 2 commits into from
Dec 9, 2024
Merged

perf(engine): add StateRootTask bench #13212

merged 2 commits into from
Dec 9, 2024

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented Dec 7, 2024

Benches the complete workflow, sending state updates from the incoming messages receiver and waiting for the final result.

@fgimenez fgimenez requested a review from shekhirin December 7, 2024 12:56
@fgimenez fgimenez added C-perf A change motivated by improving speed, memory usage or disk footprint A-trie Related to Merkle Patricia Trie implementation labels Dec 9, 2024
Copy link
Collaborator

@shekhirin shekhirin left a comment

Choose a reason for hiding this comment

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

LGTM, that's great

Comment on lines +35 to +63
for _ in 0..params.updates_per_account {
let num_accounts_in_update = rng.gen_range(1..=params.num_accounts);
let mut state_update = EvmState::default();

let selected_addresses = &all_addresses[0..num_accounts_in_update];

for &address in selected_addresses {
let mut storage = HashMap::default();
for _ in 0..params.storage_slots_per_account {
let slot = U256::from(rng.gen::<u64>());
storage.insert(
slot,
EvmStorageSlot::new_changed(U256::ZERO, U256::from(rng.gen::<u64>())),
);
}

let account = RevmAccount {
info: AccountInfo {
balance: U256::from(rng.gen::<u64>()),
nonce: rng.gen::<u64>(),
code_hash: KECCAK_EMPTY,
code: Some(Default::default()),
},
storage,
status: AccountStatus::Touched,
};

state_update.insert(address, account);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

would be nice to extend it to selfdestructs in the future as well, so that we can provide the number of deleted accounts in params

Copy link
Member Author

Choose a reason for hiding this comment

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

sg, will prepare a follow-up

Copy link
Member

@rkrasiuk rkrasiuk left a comment

Choose a reason for hiding this comment

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

agree w/ @shekhirin's comment, otherwise lgtm

@fgimenez fgimenez added this pull request to the merge queue Dec 9, 2024
Merged via the queue into main with commit 3c13295 Dec 9, 2024
42 checks passed
@fgimenez fgimenez deleted the fgimenez/srt-bench branch December 9, 2024 20:07
lean-apple pushed a commit to lean-apple/reth that referenced this pull request Dec 12, 2024
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.

4 participants