dashmap icon indicating copy to clipboard operation
dashmap copied to clipboard

Document implementation detail

Open b-zee opened this issue 2 years ago • 0 comments

Hey, thanks for this awesome library! You describe this library is an alternative to RwLock<HashMap<_, _>> in the README, but I was curious to know what alternative it poses. I didn't quite find the answer in the documentation.

You did describe it however on Hacker News:

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.

It might be worth adding this snippet to the README, as it explains the real difference with the RwLock<HashMap>...

b-zee avatar Jun 17 '22 06:06 b-zee