#hash-map #atomic #replace #rw-lock

dashmap_with_out_t_map_trait

Blazing fast concurrent HashMap for Rust

1 stable release

5.0.0 Jan 14, 2022

#886 in Concurrency

MIT license

94KB
2K SLoC

DashMap

Blazingly fast concurrent map in Rust.

DashMap is an implementation of a concurrent associative array/hashmap in Rust.

DashMap tries to implement an easy to use API similar to std::collections::HashMap with some slight changes to handle concurrency.

DashMap tries to be very simple to use and to be a direct replacement for RwLock<HashMap<K, V>>. To accomplish these goals, all methods take &self instead of modifying methods taking &mut self. This allows you to put a DashMap in an Arc<T> and share it between threads while still being able to modify it.

DashMap puts great effort into performance and aims to be as fast as possible. If you have any suggestions or tips do not hesitate to open an issue or a PR.

version

documentation

downloads

minimum rustc version

Cargo features

  • serde - Enables serde support.

  • raw-api - Enables the unstable raw-shard api.

  • rayon - Enables rayon support.

Contributing

DashMap is gladly accepts contributions! Do not hesitate to open issues or PR's.

I will take a look as soon as I have time for it.

That said I do not get paid (yet) to work on open-source. This means that my time is limited and my work here comes after my personal life.

Performance

A comprehensive benchmark suite including DashMap can be found here.

Special thanks

License

This project is licensed under MIT.

Dependencies

~0.5–1.2MB
~22K SLoC