Open benjamin-bader opened 5 years ago
Seems like the state-of-the-art in C++ OSS concurrent ordered maps is nascent. I've found a promising thesis that appears to be reasonably-implementable: http://www.utdallas.edu/~arunmoezhi/thesis.pdf
I'll have to read it more closely to verify that the algos described therein don't have some kind of fatal drawback (e.g. no memory reclamation).
Well, turns out - that paper describes its algorithm "without memory reclamation, which can be implemented with the well-known technique of hazard pointers". Har har. Like Okasaki's functional red-black tree algorithms, deletion is left as an exercise for the reader.
Found a nice hazard pointer implementation in Facebook's Folly library. Too bad it's such a huge dependency.
Java uses a ConcurrentSkipListMap, whose salient characteristics are: 1) It's threadsafe in that multiple threads can update it without significant contention 2) It is ordered - we can efficiently iterate keys in order, and find the lowest/highest key.
The STL doesn't have anything remotely like this, so we've fallen back on mutual exclusion - much to the detriment of performance of histograms and timers.