Skip to content

Commit

Permalink
small perf
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Apr 12, 2024
1 parent 952b151 commit da35e37
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/katana/core/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ impl<EF: ExecutorFactory> Backend<EF> {
block_env: &BlockEnv,
execution_output: ExecutionOutput,
) -> Result<MinedBlockOutcome, BlockProductionError> {
let mut txs = Vec::new();
let mut traces = Vec::new();
let mut receipts = Vec::new();
// we optimistically allocate the maximum amount possible
let mut txs = Vec::with_capacity(execution_output.transactions.len());
let mut traces = Vec::with_capacity(execution_output.transactions.len());
let mut receipts = Vec::with_capacity(execution_output.transactions.len());

// only include successful transactions in the block
for (tx, res) in execution_output.transactions {
if let ExecutionResult::Success { receipt, trace, .. } = res {
txs.push(tx);
Expand Down

0 comments on commit da35e37

Please sign in to comment.