Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up trades charts view load #3828

Merged
merged 2 commits into from
Jan 2, 2020

Conversation

stejbac
Copy link
Contributor

@stejbac stejbac commented Dec 23, 2019

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.

Additionally, do some tiding of TradeChartsViewModel and remove some unused constructor-injected fields from that class and others.

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:

Screenshot from 2019-12-23 23-01-07

(The also very significant com.sun.javafx.collections.VetoableListDecorator.setAll 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.)

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.
@ripcurlx
Copy link
Contributor

Just a heads up that I haven't planed to be available until 2nd of Jan, but I'll still try to do some reviews tomorrow.

Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Can't say if it's faster when running it now but it probably is. Still works and removing cruft is good.

@sqrrm sqrrm merged commit 3a74e74 into bisq-network:master Jan 2, 2020
@ripcurlx ripcurlx added this to the v1.2.5 milestone Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants