<p></p>
<p><b>@freimair</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/4233#discussion_r427826888">p2p/src/main/java/bisq/network/p2p/storage/persistence/SplitStoreService.java</a>:</p>
<pre style='color:#555'>> +                                                    PersistableNetworkPayload payload) {
+        // make sure we do not add data that we already have (in a bin of historical data)
+        if (getMap().containsKey(hash))
+            return null;
+
+        PersistableNetworkPayload previous = store.getMap().putIfAbsent(hash, payload);
+        persist();
+        return previous;
+    }
+
+
+    @Override
+    public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap() {
+        HashMap<P2PDataStorage.ByteArray, PersistableNetworkPayload> result = new HashMap<>();
+        result.putAll(store.getMap());
+        history.forEach((s, store) -> result.putAll(store.getMap()));
</pre>
<p>I thought about that. The only thing that can be cached is loading the historical data stores into the result. And since these are read-only anyways, there is nothing that changes. So why not cache it?</p>
<p>Well, the maps of the stores are in memory as well. So the data is already there and ready to be transferred. The only redirection that happens when we do it like this is that we iterate through all stores and add the data to the result. Compare that to a "cached" map of historical data, the data has to be transferred as well. The only thing we gain by caching the data is we need more RAM while saving on a few instructions to iterate through history.</p>
<p>IMO The small computational overhead does outweigh adding the complexity of another caching layer that needs to be maintained.</p>
<p>Anyways, this piece of code is going to be deprecated by <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="595721729" data-permission-text="Title is private" data-url="https://github.com/bisq-network/projects/issues/29" data-hovercard-type="issue" data-hovercard-url="/bisq-network/projects/issues/29/hovercard" href="https://github.com/bisq-network/projects/issues/29">bisq-network/projects#29</a> anyways. Then is the time IMO to really dial down performance.</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/4233#discussion_r427826888">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNS2NTYQZIJ3AMUAC5DRSOHKJANCNFSM4MY33J4A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNR6HIKY7AZX2P5PE73RSOHKJA5CNFSM4MY33J4KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODC66VJQ.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/4233#discussion_r427826888",
"url": "https://github.com/bisq-network/bisq/pull/4233#discussion_r427826888",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>