Skip to content
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(history_by_block_hash): reuse provider instead of creating two #13382

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

hai-rise
Copy link
Contributor

Towards #12838.

Currently, history_by_block_hash creates a second provider instead of reusing a created one, which unnecessarily clones a bunch and creates an extra DB transaction. This is the biggest allocation per bytehound and a suspect that causes OOM when we spam submit 20-30M transactions.

image

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

ah nice, yes definitely

@mattsse mattsse added the C-perf A change motivated by improving speed, memory usage or disk footprint label Dec 13, 2024
@mattsse
Copy link
Collaborator

mattsse commented Dec 13, 2024

btw @hai-rise a similar problem exists here:

pub fn validate_one(
&self,
origin: TransactionOrigin,
transaction: Tx,
) -> TransactionValidationOutcome<Tx> {
self.inner.validate_one(origin, transaction)
}
/// Validates all given transactions.
///
/// Returns all outcomes for the given transactions in the same order.
///
/// See also [`Self::validate_one`]
pub fn validate_all(
&self,
transactions: Vec<(TransactionOrigin, Tx)>,
) -> Vec<TransactionValidationOutcome<Tx>> {
transactions.into_iter().map(|(origin, tx)| self.validate_one(origin, tx)).collect()

this could use the same provider for all txs, could easily do this if we flip these

@mattsse
Copy link
Collaborator

mattsse commented Dec 13, 2024

let me open an issue for this

@mattsse mattsse added this pull request to the merge queue Dec 13, 2024
Merged via the queue into paradigmxyz:main with commit df697f2 Dec 13, 2024
43 checks passed
@hai-rise hai-rise deleted the reuse-provider branch December 13, 2024 14:36
emhane pushed a commit to ethereum-optimism/op-reth that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants