Skip to content

perf(txpool): reduce map lookups when inserting AA 2D transactions#5602

Merged
mattsse merged 1 commit into
mainfrom
mattsse/txpool-add-path-opts
Jun 10, 2026
Merged

perf(txpool): reduce map lookups when inserting AA 2D transactions#5602
mattsse merged 1 commit into
mainfrom
mattsse/txpool-add-path-opts

Conversation

@mattsse

@mattsse mattsse commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Profiling a saturated AA 2D pool at 50k TPS showed the txs_by_sender lookups account for roughly a third of insertion time: every insert did a get for the per-sender limit check plus a separate entry to increment the count. These are now a single map operation.

Two more lookups removed on the same path: the by_hash duplicate 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.

@mattsse mattsse requested review from 0xKitsune and klkvr as code owners June 10, 2026 14:23
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.
@mattsse mattsse force-pushed the mattsse/txpool-add-path-opts branch from a6a6e78 to 926c9ec Compare June 10, 2026 14:48
@mattsse mattsse added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 3395faa Jun 10, 2026
33 checks passed
@mattsse mattsse deleted the mattsse/txpool-add-path-opts branch June 10, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants