<p></p>
<p>Thanks <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/stejbac/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/stejbac">@stejbac</a> for the review and comments!</p>
<p>I just did some measurments:<br>
CurrencyUtil2 is the version from that PR, CurrencyUtil the master version.</p>
<p>With wrong Fiat, wrong crypto<br>
Dec-15 08:47:47.029 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil2.isCryptoCurrency for 100000000 iterations took 1937 ms<br>
Dec-15 08:47:48.910 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil2.isFiatCurrency for 100000000 iterations took 1881 ms<br>
Dec-15 08:47:51.882 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil.isCryptoCurrency for 100000000 iterations took 2972 ms<br>
Dec-15 08:47:54.016 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil.isFiatCurrency for 100000000 iterations took 2134 ms</p>
<p>With correct Fiat and crypto<br>
Dec-15 08:48:48.699 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil2.isCryptoCurrency for 100000000 iterations took 1791 ms<br>
Dec-15 08:48:50.596 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil2.isFiatCurrency for 100000000 iterations took 1897 ms<br>
Dec-15 08:48:52.714 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil.isCryptoCurrency for 100000000 iterations took 2117 ms<br>
Dec-15 08:48:56.286 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil.isFiatCurrency for 100000000 iterations took 3572 ms</p>
<p>With correct Fiat and crypto using concurrentHashMap in CurrencyUtil2<br>
Dec-15 08:49:37.739 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil2.isCryptoCurrency for 100000000 iterations took 1752 ms<br>
Dec-15 08:49:39.516 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil2.isFiatCurrency for 100000000 iterations took 1777 ms<br>
Dec-15 08:49:41.637 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil.isCryptoCurrency for 100000000 iterations took 2121 ms<br>
Dec-15 08:49:45.104 [SeedNodeMain] ERROR b.s.SeedNode: CurrencyUtil.isFiatCurrency for 100000000 iterations took 3467 ms</p>
<p>It seems the Currency.getInstance(currencyCode) is the "expensive" one.<br>
The difference is not dramatic, so no strong opinion if we should merge that PR or close it. The methods are called very often so the 100M iteration is not totally crazy (2M times in a short profiling session without lot of UI interaction). To look why they are called that often would be another task, but I assume a big part are Comparators and that sums up quickly at list sorting operations.</p>

<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/4955#issuecomment-745302802">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNU43GIOFSR3C6BSIYLSU5TVRANCNFSM4U32MLCA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUX3IGXMTP3NHULZYLSU5TVRA5CNFSM4U32MLCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFRWGWEQ.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/4955#issuecomment-745302802",
"url": "https://github.com/bisq-network/bisq/pull/4955#issuecomment-745302802",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>