Skip to content

Conversation

rakita
Copy link
Member

@rakita rakita commented Aug 11, 2025

Journal function now contain AddressOrId field that allow fetching account by or or by address

Output state is now a index map, that contains pages of accounts and hashmap that maps address to the index.

Analysis:
codspeed times are very slower than running on machine but even with them we can see order of magnitude difference between transfer and CALLs. 1000tx transfers with commit take 2.8ms that means one transfer is 2.8us and degradation is 0.2us per transaction, while 50 CALLs are 97us and it is improved to 91 µs
And when i run this on machine, revme bench transfer-multi I get transact_commit_1000txs time: [387.81 µs 393.68 µs 398.68 µs] which means on the real machine it is 0.4us per transaction and diff is 0.05us or 50ns .

For context 50ns degradation for 3 billion transactions (number of mainnet transactions) are few (two/three) minutes of difference.

My conclusion is even if transact_commit_1000tx is worse by 7%, an improvement of 7% for CALL or %5 SSTORE is worth a lot more.

Copy link

codspeed-hq bot commented Aug 11, 2025

CodSpeed Performance Report

Merging #2878 will degrade performances by 7.38%

Comparing rakita/account_id (eeb6938) with main (6697f70)

Summary

⚡ 7 improvements
❌ 2 (👁 1) regressions
✅ 164 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
CALL_50 97.5 µs 91 µs +7.09%
DELEGATECALL_50 92 µs 88.1 µs +4.42%
JUMPDEST_50 15.5 µs 16 µs -3.31%
RETURN_50 111.1 µs 103.8 µs +7%
REVERT_50 112.7 µs 105 µs +7.29%
SSTORE_50 33.1 µs 31.3 µs +5.7%
STATICCALL_50 96.9 µs 89.4 µs +8.39%
transact_1000tx_commit_inner_every_40 2 ms 2 ms +4.33%
👁 transact_commit_1000txs 2.8 ms 3 ms -7.38%

@rakita rakita changed the title wip feat(Jurnal): Accounts saved in index map. feat(Jurnal): Accounts saved in index map. Aug 15, 2025
fn sload(
&mut self,
address: Address,
address_or_id: AddressOrId,
Copy link
Member Author

Choose a reason for hiding this comment

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

Interface got changed so it now can process both account id or address.

Account id is obtained on loading of the account and it can be used to fetch the account faster from journal.

}

/// Warms the coinbase account.
fn warm_coinbase_account(&mut self, address: Address);
Copy link
Member Author

Choose a reason for hiding this comment

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

We can load coinbase from the start and make it warm (if needed), as fetching it in post execution state is going to be fast with account id.

fn get_account(&mut self, account_id: AccountId) -> (&Account, AddressAndId);

/// Sets the caller id.
fn set_caller_address_id(&mut self, id: AddressAndId);
Copy link
Member Author

Choose a reason for hiding this comment

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

Caller/coinbase/txtarget addresses and ids are saved in Journal so they can be fetched on demand.

) -> Vec<(Address, TransitionAccount)> {
let mut transitions = Vec::with_capacity(evm_state.len());
for (address, account) in evm_state {
for (account, address) in evm_state.take_accounts().into_iter().flatten() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Iterating over accounts

let auth_acc = state.get(&signer.address()).unwrap();
assert_eq!(auth_acc.info.code, Some(Bytecode::new_eip7702(FFADDRESS)));
assert_eq!(auth_acc.info.nonce, 1);
println!("state: {:#?}", state);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
println!("state: {:#?}", state);

@rakita rakita mentioned this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants