Introduce clone-able state provider builder for tree state #14136
Labels
A-engine
Related to the engine implementation
C-enhancement
New feature or request
C-perf
A change motivated by improving speed, memory usage or disk footprint
Creating a state provider can take anywhere from 20us to 200us, with average time for each prewarm transaction being ~70 microseconds. If the block has 150 transaction, creating these state providers in a loop can cost us about 10.5 milliseconds.
The way to fix this latency is to create the state provider in the thread rather than in the critical path.
This means creating a state provider builder, that can be returned from the tree. This should clone the tree's
provider
field:reth/crates/engine/tree/src/tree/mod.rs
Line 527 in 3e0cd2e
And call
blocks_by_hash
:reth/crates/engine/tree/src/tree/mod.rs
Lines 151 to 165 in 3e0cd2e
To construct the builder data structure.
This data structure should have a method for creating a state provider:
reth/crates/engine/tree/src/tree/mod.rs
Lines 1729 to 1758 in 3e0cd2e
This can then be called in each prewarm thread to create the state provider.
The text was updated successfully, but these errors were encountered: