-
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(tree): state provider builder #14279
Conversation
3db0e67
to
2695011
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.
Just have one comment, this looks very good already!
crates/engine/tree/src/tree/mod.rs
Outdated
/// Returns a builder for creating state providers for the given hash. | ||
/// | ||
/// This is used to optimize state provider creation in parallel execution contexts. | ||
pub fn state_provider_builder<P>( | ||
&self, | ||
provider: P, | ||
hash: B256, | ||
) -> Option<StateProviderBuilder<N, P>> | ||
where | ||
P: BlockReader + StateProviderFactory + StateReader + StateCommitmentProvider + Clone, | ||
{ | ||
let (historical, blocks) = self.blocks_by_hash(hash)?; | ||
Some(StateProviderBuilder { provider, historical, blocks }) | ||
} |
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.
I think we can remove this method and call self.blocks_by_hash
+ init the builder in the other state_provider_builder
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.
Hi just saw this thanks for review and fixing
also needs fmt |
taking over as this is urgent now |
Co-authored-by: Dan Cline <[email protected]>
Overview
Introduces a cloneable state provider builder to optimize state provider creation by moving it out of the critical execution path.
Closes #14136