<p>Compute height cells lazily to speed up <code>DaoStateMonitorView</code></p>
<p>Avoid a bottleneck computing the cycle index & calling <code>Res.get(..)</code> for every block since genesis in the DAO state monitor view, when building the <code>DaoStateBlockListItem</code> objects, by making the <code>height</code> field lazy. To do this, pass the cycle index into the constructor using an <code>IntSupplier</code> and make the height a memoised <code>Supplier<String></code> with a custom getter.</p>
<p>Also add a unit test to check that the auto-generated <code>equals</code> & <code>hashCode</code> methods still work as expected, as it isn't totally clear what Lombok would do when a field type differs from its getter return type.</p>
<p>--</p>
<p>Flippling back and forth between the <em>Network monitor</em> tab and the <em>Governance</em> tab revealed the following call tree in JProfiler:</p>
<p><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/54855381/76194185-9b2b4080-6220-11ea-911d-73f6df162636.png"><img src="https://user-images.githubusercontent.com/54855381/76194185-9b2b4080-6220-11ea-911d-73f6df162636.png" alt="Screenshot from 2020-03-06 10-16-21" style="max-width:100%;"></a></p>
<p>As can be seen above, most of the time is spent in the stream pipeline collecting new <code>DaoStateBlockListItem</code> objects, in <code>DaoStateMonitorView.onDataUpdate</code>. After the change, the main bottleneck appeared to be from internal JavaFX code, in the <code>listItems.setAll</code> call in <code>onDataUpdate</code> (perhaps from one of the listeners on <code>DaoStateMonitorView.sortedList</code>). However, I believe there was a noticeable speedup. Also, the slowdown over time is likely to be quadratic without the change, as the number of cycles and block grows linearly. (The main bottleneck appears to be computing the cycle index of each block.)</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/4035'>https://github.com/bisq-network/bisq/pull/4035</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Avoid raw use of Overlay<T></li>
  <li>Compute height cells lazily to speed up DaoStateMonitorView</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4035/files#diff-983f465fba37d94e2376c264467401b8">desktop/src/main/java/bisq/desktop/main/MainViewModel.java</a>
    (22)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4035/files#diff-6abe73b8d7a004bd074053953967bcc0">desktop/src/main/java/bisq/desktop/main/dao/monitor/StateBlockListItem.java</a>
    (31)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4035/files#diff-a9ae813d39e48e40407885850a47bcf7">desktop/src/main/java/bisq/desktop/main/dao/monitor/daostate/DaoStateBlockListItem.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4035/files#diff-4f3aba49c9fe5a4f20643198e7c835bd">desktop/src/main/java/bisq/desktop/main/dao/monitor/daostate/DaoStateMonitorView.java</a>
    (25)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4035/files#diff-8143d46c5a2fc15da135465947a688b8">desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java</a>
    (3)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4035/files#diff-38ca5c4088447e24e86fb34e252e9ea5">desktop/src/test/java/bisq/desktop/main/dao/monitor/daostate/DaoStateBlockListItemTest.java</a>
    (63)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/4035.patch'>https://github.com/bisq-network/bisq/pull/4035.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/4035.diff'>https://github.com/bisq-network/bisq/pull/4035.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/4035?email_source=notifications&email_token=AJFFTNX6W2NMEKZPUVQJPMLRGSUTTA5CNFSM4LEDYR7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ITPWUTQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNWFGPHQHZJV5ACTRZLRGSUTTANCNFSM4LEDYR7A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNS2TKOAGS73DEPX4FDRGSUTTA5CNFSM4LEDYR7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ITPWUTQ.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/4035?email_source=notifications\u0026email_token=AJFFTNX6W2NMEKZPUVQJPMLRGSUTTA5CNFSM4LEDYR7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ITPWUTQ",
"url": "https://github.com/bisq-network/bisq/pull/4035?email_source=notifications\u0026email_token=AJFFTNX6W2NMEKZPUVQJPMLRGSUTTA5CNFSM4LEDYR7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ITPWUTQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>