Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Speed up trades charts view load #3828
In particular, this speeds up the activation of
Additionally, do some tiding of
To reproduce the hotspot, one can select the Trades tab under Market at least once, then flipping repeatedly between (say) the Market and Buy BTC panels, the following hotspots are revealed by JProfiler:
(The also very significant
These are mostly injected objects that are now redundant, such as some CoinFormatter and Preferences fields. Also do some additional minor tidying of TradesChartsViewModel.
Use a LinkedHashMap in place of a List, for the caching CurrencyUtil fields 'allSortedFiatCurrencies' & 'allSortedCryptoCurrencies', using the same iteration order as before. In this way, we can avoid a linear search in the lookup methods getFiatCurrency & getCryptoCurrency. In particular, this speeds up the activation of TradesChartsView (and to a lesser extent OfferBookChartView), which make a lot of calls to CurrencyUtil.getTradeCurrency in the fillTradeCurrencies/updateChartData methods respectively.