<p><code>BlockParser.parseBlock()</code> normally takes about 300ms per block.</p>
<p>One part of it is checking if the new block hash is known, which was done by string-comparing it to the hashes of all known blocks. In my case, this was about 110 000 string-comparisons per <code>BlockParser.parseBlock()</code> call.</p>
<p>This commit adds a block hash cache in the <code>DaoState</code> and replaces the hash string-comparisons by one <code>HashSet</code> lookup.</p>
<p>With this change, <code>BlockParser.parseBlock()</code> takes around 200ms on my setup.</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/5484'>https://github.com/bisq-network/bisq/pull/5484</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Improve timer accuracy in BlockParser</li>
  <li>Cache block hashes in DaoState</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5484/files#diff-f0a8e8faa43f00abc339b9e85ea90dd59b9a39838aa3d5ca1795c3ab2ee48a7d">core/src/main/java/bisq/core/dao/node/parser/BlockParser.java</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5484/files#diff-edaebc6cc1964f376f3c6cf8b664f9cf3a3288bd6432b2f436702a37e4e2345d">core/src/main/java/bisq/core/dao/state/DaoStateService.java</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5484/files#diff-b9b585fac65012576c8936fc8f641372588862ec84b7b0b926c3e493e8b37c59">core/src/main/java/bisq/core/dao/state/model/DaoState.java</a>
    (17)
  </li>
</ul>

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