perf(txpool): reduce map lookups when inserting AA 2D transactions#5602
Merged
Conversation
Profiling a saturated AA 2D pool showed the txs_by_sender lookups account for roughly a third of insertion time. The per-sender limit check and count increment are now a single map operation instead of a separate lookup plus entry call. Also skips the by_hash duplicate check for expiring nonce transactions, since a duplicate maps to the same expiring nonce hash which the expiring map entry already rejects, and stops the descendant promotion scan once it reaches an already-pending transaction because the rest of the contiguous sequence must be pending as well.
a6a6e78 to
926c9ec
Compare
klkvr
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Profiling a saturated AA 2D pool at 50k TPS showed the
txs_by_senderlookups account for roughly a third of insertion time: every insert did agetfor the per-sender limit check plus a separateentryto increment the count. These are now a single map operation.Two more lookups removed on the same path: the
by_hashduplicate check is skipped for expiring nonce transactions since the expiring nonce hash entry already rejects duplicates, and the descendant promotion scan exits once it reaches an already-pending transaction.Measured with the benchmark from #5598 (10k transaction pool): filling the pool improves ~40% for both expiring and regular 2D nonce transactions, inserting into a 2D pool at capacity ~16%.
Extracted from #5598.