<p>Use a <code>LinkedHashMap</code> in place of a <code>List</code>, for the caching <code>CurrencyUtil</code> fields <code>allSortedFiatCurrencies</code> & <code>allSortedCryptoCurrencies</code>, using the same iteration order as before. In this way, we can avoid a linear search in the lookup methods <code>getFiatCurrency</code> & <code>getCryptoCurrency</code>.</p>
<p>In particular, this speeds up the activation of <code>TradesChartsView</code> (and to a lesser extent <code>OfferBookChartView</code>), which make a lot of calls to <code>CurrencyUtil.getTradeCurrency</code> in the <code>fillTradeCurrencies</code>/<code>updateChartData</code> methods respectively.</p>
<p>Additionally, do some tiding of <code>TradeChartsViewModel</code> and remove some unused constructor-injected fields from that class and others.</p>
<p>To reproduce the hotspot, one can select the <em>Trades</em> tab under <em>Market</em> at least once, then flipping repeatedly between (say) the <em>Market</em> and <em>Buy BTC</em> panels, the following hotspots are revealed by JProfiler:</p>
<p><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/54855381/71384295-64a63800-25d8-11ea-808b-a7522077f490.png"><img src="https://user-images.githubusercontent.com/54855381/71384295-64a63800-25d8-11ea-808b-a7522077f490.png" alt="Screenshot from 2019-12-23 23-01-07" style="max-width:100%;"></a></p>
<p>(The also very significant <code>com.sun.javafx.collections.VetoableListDecorator.setAll</code> hotspot seen at the bottom of the screenshot occurs during the initialisation of many views, but I haven't been able to find the cause or a fix for that yet.)</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/3828'>https://github.com/bisq-network/bisq/pull/3828</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Remove unused fields passed as constructor params from various classes</li>
  <li>Optimise CurrencyUtil.get[Fiat|Crypto|Trade]Currency</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-0">core/src/main/java/bisq/core/app/WalletAppSetup.java</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-1">core/src/main/java/bisq/core/dao/governance/votereveal/VoteRevealService.java</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-2">core/src/main/java/bisq/core/locale/CurrencyUtil.java</a>
    (46)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-3">core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-4">desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-5">desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-6">desktop/src/main/java/bisq/desktop/main/MainView.java</a>
    (10)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-7">desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-8">desktop/src/main/java/bisq/desktop/main/account/content/notifications/ManageMarketAlertsWindow.java</a>
    (24)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-9">desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-10">desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.java</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-11">desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-12">desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModel.java</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-13">desktop/src/main/java/bisq/desktop/main/market/trades/TradesChartsViewModel.java</a>
    (47)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-14">desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-15">desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-16">desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferViewModel.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-17">desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-18">desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java</a>
    (10)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-19">desktop/src/main/java/bisq/desktop/main/presentation/MarketPricePresentation.java</a>
    (15)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-20">desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-21">desktop/src/main/java/bisq/desktop/main/settings/network/P2pNetworkListItem.java</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-22">desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-23">desktop/src/test/java/bisq/desktop/MarketsPrintTool.java</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-24">desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java</a>
    (20)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3828/files#diff-25">desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java</a>
    (9)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/3828.patch'>https://github.com/bisq-network/bisq/pull/3828.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/3828.diff'>https://github.com/bisq-network/bisq/pull/3828.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/3828?email_source=notifications&email_token=AJFFTNRDHGFOE4NTNEQUJ53Q2FBJDA5CNFSM4J6Y4DG2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ICNHGPQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNSPVESLJ7EXVBK3WVLQ2FBJDANCNFSM4J6Y4DGQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUERZQAZDY3I6FXQWDQ2FBJDA5CNFSM4J6Y4DG2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ICNHGPQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/3828?email_source=notifications\u0026email_token=AJFFTNRDHGFOE4NTNEQUJ53Q2FBJDA5CNFSM4J6Y4DG2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ICNHGPQ",
"url": "https://github.com/bisq-network/bisq/pull/3828?email_source=notifications\u0026email_token=AJFFTNRDHGFOE4NTNEQUJ53Q2FBJDA5CNFSM4J6Y4DG2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ICNHGPQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>