PR-3 Performance: Swap and trade quote latency is ~3 seconds; no input debounce means every keystroke fires a simulation #346
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#346
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On both the
/swapand/tradepages, typing an amount into the input field produces a ~3-second delay before a quote estimate appears. The PR-3 criterion requires sub-second latency under normal conditions. The delay compounds because there is no debounce on the amount input: each keystroke immediately changesrawInputAmount, which is part of the simulation query key, which fires a new React Query simulation before the previous one completes.Observed behavior
Root cause area
Two contributing factors identified in code:
1. No debounce on amount input
In SwapPage.tsx,
rawInputAmountis derived directly frominputAmountstate and is included insimQueryKey(line 347). There is no debounce between input change and query dispatch. Each character the user types changes the query key and fires a fresh simulation immediately.2. Sequential indexer + LCD calls
The simulation query function (
simQuery, line 374) calls the indexer for route optimization and then calls the Terra LCD forsimulate_swap_operations. On LocalTerra, both calls are slower than on a production node. The two calls are not parallelized for the common case.Reproduction steps
/swapor/tradeon LocalTerraExpected behavior
Quote estimate should appear within ~1 second of the user finishing input. A debounce of 300-500ms on the amount input field would prevent intermediate keystrokes from firing simulations and would reduce the effective query rate to one per user pause.
Actual behavior
Quote latency is ~3 seconds. Every keystroke fires a simulation. The user sees a loading state for the full round-trip time of each query.
Impact assessment
Environment
/swap,/tradeSeverity: P2(Polish) -- UX degradation; does not affect correctness of quotes or fund safety.
Related checklist items: PR-3
cc: @PlasticDigits
mentioned in issue #291
mentioned in issue #355
mentioned in commit
b6fb88bce2MR opened. 350ms debounce + keepPreviousData on Swap/Trade market sim queries.
mentioned in merge request !855
mentioned in commit
338947b1c2marked as related to #356
mentioned in issue #356
mentioned in issue #360
mentioned in issue #485