mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Short circuit the BigInteger arithmetic in 'AltcoinExchangeRate' & 'org.bitcoinj.utils.ExchangeRate' (from which the former is adapted), by using ordinary long arithmetic when it is guaranteed not to overflow due to the two quantities to be multiplied fitting in an int. This will be the case most of the time. Also remove duplicated logic, to ensure that all conversions of BTC amounts to volumes happen via the 'Price' instance methods, so that the optimisation always applies. In particular, this speeds up the BTC -> BSQ conversions in the burning man view, as well as the USD price calculations for the candles in the trades charts view via 'TradeStatistics3.getTradeVolume()'. Additionally, fix the lazy initialisation pattern in TradeStatistics3 to ensure that it is thread safe (that is, it only has benign data races), by making it of the form: Foo foo = this.foo; if (foo == null) { this.foo = foo = computeFoo(); } return foo; This avoids the problem that 'foo' is a nonvolatile field and can therefore be seen to alternate any number of times between null and nonnull from the PoV of the thread initialising it (at least when the initialisation is racy). |
||
---|---|---|
.. | ||
.tx | ||
src | ||
build.gradle | ||
update_translations.sh |