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: prevent changed senders clone #13194

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions crates/transaction-pool/src/pool/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,12 @@ impl<T: TransactionOrdering> TxPool<T> {
&mut self,
changed_senders: HashMap<SenderId, SenderInfo>,
) -> UpdateOutcome<T::Transaction> {
// track changed accounts
self.sender_info.extend(changed_senders.clone());
// Apply the state changes to the total set of transactions which triggers sub-pool updates.
let updates = self.all_transactions.update(changed_senders);
let updates = self.all_transactions.update(&changed_senders);

// track changed accounts
self.sender_info.extend(changed_senders);

// Process the sub-pool updates
let update = self.process_updates(updates);
// update the metrics after the update
Expand Down Expand Up @@ -1180,7 +1182,7 @@ impl<T: PoolTransaction> AllTransactions<T> {
/// that got transaction included in the block.
pub(crate) fn update(
&mut self,
changed_accounts: HashMap<SenderId, SenderInfo>,
changed_accounts: &HashMap<SenderId, SenderInfo>,
) -> Vec<PoolUpdate> {
// pre-allocate a few updates
let mut updates = Vec::with_capacity(64);
Expand Down
Loading