3 ms·
I am curious how this differs from chashmap: https://gitlab.redox-os.org/redox-os/chashmap https://gitlab.redox-os.org/redox-os/chashmap They provide benchmar
by CameronNemo 7y ago
I am curious how this differs from chashmap:
https://gitlab.redox-os.org/redox-os/chashmap https://gitlab.redox-os.org/redox-os/chashmap
They provide benchmarks, but I would be more interested to know how the implementation differs.
- Jonhoo 7y agoI can't speak to the implementation differences between the two, but I know the author of dashmap is relatively active in responding online, so they may show up shortly to explain. In terms of performance comparisons, we're actually working on building a shared benchmarking tool for all of Rust's concurrent maps that you may find interesting: https://github.com/jonhoo/bustle https://github.com/jonhoo/bustle.
- xacrimon 7y agoHi! I am the author of dashmap. CHashMap is essentially a table behind an rwlock where each slot is also behind its own rwlock. This is great in theory since it allows decently concurrent operations providing they don't need to lock the whole table for resizing. In practice this falls short quickly because of the contention on the outer lock and the large amount of locks and unlocks when traversing the map. dashmap works by splitting into an array of shards, each shard behind its own rwlock. The shard is decided from the keys hash. This will only lock and unlock once for any one shard and allows concurrent table locking operations provided they are on different shards. Further, there is no central rwlock each thread must go thru which improves performance significantly.