Skip to content

perf: cut redundant entity loads on swap/liquidity path - #92

Open
paymog wants to merge 2 commits into
Uniswap:mainfrom
goldsky-io:paymahn/perf-reduce-entity-loads
Open

perf: cut redundant entity loads on swap/liquidity path#92
paymog wants to merge 2 commits into
Uniswap:mainfrom
goldsky-io:paymahn/perf-reduce-entity-loads

Conversation

@paymog

@paymog paymog commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • Pass already-loaded Pool / PoolManager / Bundle into interval + pricing helpers so swaps/liquidity updates stop re-loading the same entities multiple times per handler
  • Thread Bundle through findNativePerToken and getTrackedAmountUSD
  • Cap whitelist pool walks in findNativePerToken at 8 to bound O(N) pricing loads on tokens with long whitelistPools lists

Motivation

On busy pools, each swap was paying many redundant entity loads (Bundle ~7×, plus repeated Pool / PoolManager loads inside interval helpers). That shows up as mapping host time / store get volume under load. Behavior should be unchanged for the common path; the whitelist walk cap only affects tokens with more than 8 whitelist pools (prefers earlier list entries).

Test plan

  • Existing matchstick tests updated for new helper signatures
  • yarn test / CI green
  • Sanity: initialize + swap fixtures still assert expected derivedETH / volume fields

paymog added 2 commits July 27, 2026 08:52
Pass already-loaded Pool/PoolManager/Bundle into interval and pricing
helpers so each swap no longer reloads Bundle ~7x and Pool/PoolManager
multiple times.

Also thread Bundle through findNativePerToken/getTrackedAmountUSD and
cap whitelist pool walks at 8 to bound pricing O(N) loads.
@jeffling
jeffling force-pushed the paymahn/perf-reduce-entity-loads branch from 05c7ae7 to 6fd8010 Compare July 30, 2026 00:35
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.

1 participant