Avoid repeated Set<Tradable> build in transactions view load

Move the line,

   Set<Tradable> tradables = tradableRepository.getAll();

to the top level of 'TransactionsView.updateList', instead of needlessly
calling 'TradableRepository.getAll' (which builds a new set every
invocation) for each wallet transaction being iterated over.

This was causing a significant slowdown of the view load.
This commit is contained in:
Steven Barclay 2023-02-09 21:35:32 +08:00
parent 3aacc99f38
commit fb78345ba3
No known key found for this signature in database
GPG key ID: 9FED6BF1176D500B

View file

@ -288,11 +288,11 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
}
private void updateList() {
Set<Tradable> tradables = tradableRepository.getAll();
List<TransactionsListItem> transactionsListItems = btcWalletService.getTransactions(false)
.stream()
.map(transaction -> {
Set<Tradable> tradables = tradableRepository.getAll();
TransactionAwareTradable maybeTradable = tradables.stream()
.map(tradable -> {
if (tradable instanceof OpenOffer) {