-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
9780ff0
to
cf46903
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.
LGTM, that's great
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); | ||
} |
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.
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
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.
sg, will prepare a follow-up
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.
agree w/ @shekhirin's comment, otherwise lgtm
Benches the complete workflow, sending state updates from the incoming messages receiver and waiting for the final result.