<p>I've just pushed changes to address some of the issues pointed out above. I renamed <code>toProtoMessageSynchronized</code> and added <code>UserThreadMappedPersistableEnvelope</code> as suggested. There was another commit I intended to push to serialise <code>SequenceNumberMap</code> on the user thread, by making it implement the new interface instead of <code>ThreadedPersistableEnvelope</code>. However, benchmarking the code in the same way as above showed that it adds considerable overhead:</p>
<p><a href="https://github.com/bisq-network/bisq/files/4311586/Serialisation_Benchmarks_with_SequenceNumberMap.txt">Serialisation_Benchmarks_with_SequenceNumberMap.txt</a></p>
<p>I think it would be better to make it continue to implement <code>ThreadedPersistableEnvelope</code> and rely on the concurrency guarantees of <code>ConcurrentHashMap</code> if possible. (That should effectively synchronise reads and updates of the optional map value, at each potential key independently.)</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/4025?email_source=notifications&email_token=AJFFTNRHQD7X7HFRZULXJOLRGYGP5A5CNFSM4LBEPX62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKY6OI#issuecomment-597004089">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNVZJSCF43V6EBL36ITRGYGP5ANCNFSM4LBEPX6Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNQNDB7OGGTQVJQJN6LRGYGP5A5CNFSM4LBEPX62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKY6OI.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/4025?email_source=notifications\u0026email_token=AJFFTNRHQD7X7HFRZULXJOLRGYGP5A5CNFSM4LBEPX62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKY6OI#issuecomment-597004089",
"url": "https://github.com/bisq-network/bisq/pull/4025?email_source=notifications\u0026email_token=AJFFTNRHQD7X7HFRZULXJOLRGYGP5A5CNFSM4LBEPX62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKY6OI#issuecomment-597004089",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>