Speed up loading and scrolling of trade history #6552
Merged
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.
This PR fixes a quadratic time bug while filtering the list of BSQ swap trades for their tx confirmation status, as needed by
ClosedTradesView
. It also fixes a (sort-of) cubic time bug caused by the repeated invocation ofClosedTradableManager.getNumPastTrades
(once for each list item). It does this by caching the peer node address counts over all the closed trades & confirmed BSQ swaps, as well as caching a mapping of txIds to txs inWalletService
to avoid repeated copying and scanning of the wallet tx list while checking for confirmation status by txId.These issues were making the closed trades view load extremely slow on my Bisq instance (taking more than 20s), which has around 1300 past trades, a bit under half of which are BSQ swaps. It was also making scrolling and paging almost unusable. The following is a screenshot of the hotspots from JProfiler, prior to the changes: