Our great sponsors
-
parallel-hashmap
A family of header-only, very fast and memory-friendly hashmap and btree containers.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
But it's pretty easy to address this. The CoinsViewCache's underlying storage is just a std::map<...>. A while ago, I replaced that with a sparsepp hashtable to improve the memory efficiency. It wasn't hard to do; took a couple of hours. We could do the same thing with a concurrent hashtable implementation. The hardest part of doing this would be picking an implementation and validating that it's mature and stable enough to be used in BCHN. Intel's Threading Building Blocks has some good candidates, but it's also possible that another implementation might be more suitable.
Also, the phmap::parallel_flat_hash_map can be used from multiple threads without any locking, if you are willing to add a little extra code. If hash map contention is a bottleneck, this can be amazingly better. There is an example of doing this there. I have used this with great success myself (not in crypto code though, just started working in Ethereum recently).
Incidentally: https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node/-/merge_requests/955