perf(db): reduce different repeated allocations (#2103)

This commit is contained in:
joshieDo
2023-04-13 23:33:53 +08:00
committed by GitHub
parent 2f003bf8ae
commit 019ddd1edc
32 changed files with 358 additions and 181 deletions

View File

@ -32,4 +32,5 @@ enum StageEnum {
Execution,
Hashing,
Merkle,
TxLookup,
}

View File

@ -16,7 +16,7 @@ use reth_staged_sync::{
Config,
};
use reth_stages::{
stages::{BodyStage, ExecutionStage, SenderRecoveryStage},
stages::{BodyStage, ExecutionStage, SenderRecoveryStage, TransactionLookupStage},
ExecInput, Stage, StageId, UnwindInput,
};
use std::{net::SocketAddr, sync::Arc};
@ -181,6 +181,16 @@ impl Command {
}
stage.execute(&mut tx, input).await?;
}
StageEnum::TxLookup => {
let mut stage = TransactionLookupStage::new(num_blocks);
// Unwind first
if !self.skip_unwind {
stage.unwind(&mut tx, unwind).await?;
}
stage.execute(&mut tx, input).await?;
}
_ => {}
}