Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
sync: reduce contention between Map operations with new-but-disjoint keys #21035
The Go 1.9 implementation of
That doesn't really matter for the
We should explore ways to address new-key contention, such as sharding the read-write maps and associated locks (as suggested in #20360), journaling writes (and using a Bloom or HyperLogLog filter to avoid reading the journal, along the lines of #21032), or storing the read-write map in an atomic tree data structure instead of a built-in
I use a slightly modified version of this in my code, but I wanted to do that with sync.Map in a way, but that'd require a lot more runtime knowledge to be able to use runtime/map's hasher directly to do the sharding rather than double hash it.
Sadly I don't have the knowledge nor time to learn the internals of runtime/map right now.
By all means if you can do that, it'd be great or we can discuss it.