Skip to content

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Jul 2, 2025

This pull introduces a Prefetch operation in the trie to prefetch trie nodes in parallel.
It is used by the triePrefetcher to accelerate state loading and improve overall
chain processing performance.

@rjl493456442
Copy link
Member Author

rjl493456442 commented Jul 3, 2025

Bench07: PR
Bench08: Master

Memory allocation and CPU utilization has been reduced a lot by removing IntermediateRoot
call in prefetcher.

截屏2025-08-18 20 43 22

The overall performance is slightly faster, improved by the accountUpdate and storageUpdate parts
截屏2025-08-18 20 44 26
截屏2025-08-18 20 44 51
截屏2025-08-18 20 45 12

@fjl fjl removed the status:triage label Jul 15, 2025
@rjl493456442 rjl493456442 changed the title trie, core/state: introduce Touch operation in trie to fasten preload trie, core/state: introduce Touch in trie for optimizing preload Aug 11, 2025
@rjl493456442 rjl493456442 force-pushed the trie-getbatch branch 2 times, most recently from 3ff33f4 to 74a1edb Compare August 11, 2025 14:22
@rjl493456442 rjl493456442 changed the title trie, core/state: introduce Touch in trie for optimizing preload trie, core/state: introduce trie Prefetch for optimizing preload Aug 11, 2025
for _, k := range ks {
_, newnode, didResolve, err := t.get(fn.Children[pos], k, 1)
if err == nil && didResolve {
fn.Children[pos] = newnode
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to store the resolved node here?

Copy link
Member

Choose a reason for hiding this comment

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

ah so we don't resolve them again on the next iteration

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 have to store the resolved nodes, otherwise the resolved descendants will be lost

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

LGTM

@rjl493456442
Copy link
Member Author

@MariusVanDerWijden I just pushed a tiny commit on top, please check it again.

@rjl493456442 rjl493456442 merged commit bf8f63d into ethereum:master Aug 20, 2025
4 of 5 checks passed
@rjl493456442 rjl493456442 added this to the 1.16.3 milestone Aug 20, 2025
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
…ereum#32134)

This pull introduces a `Prefetch` operation in the trie to prefetch trie
nodes in parallel. It is used by the `triePrefetcher` to accelerate state 
loading and improve overall chain processing performance.
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.

3 participants