perf: use Vec::with_capacity and reserve_exact (#11904)

This commit is contained in:
nk_ysg
2024-10-21 19:59:09 +08:00
committed by GitHub
parent aba4991d0a
commit f25cceb9f9
13 changed files with 22 additions and 17 deletions

View File

@ -109,6 +109,7 @@ where
match self.pool.get_all_blobs_exact(txs.iter().map(|(tx, _)| tx.hash()).collect()) {
Ok(blobs) => {
actions_to_queue.reserve_exact(txs.len());
for ((tx, _), sidecar) in txs.iter().zip(blobs.iter()) {
let transaction = BlobTransaction::try_from_signed(tx.clone(), sidecar.clone())
.expect("should not fail to convert blob tx if it is already eip4844");