Rust

Rust

Made by DeepSource

Found occurrence of Arc<RwLock<HashMap<K, V>>> RS-P1003

Performance
Minor

Arc<RwLock<HashMap<K, V>>> has performance concerns, the dashmap crate provides a much better alternative to concurrent hashmaps. Hence, Arc<RwLock<HashMap<K, V>>> is better off replaced by Arc<DashMap<K, V>> from the dashmap crate.

Bad practice

struct Bar<K, V> { foo: Arc<RwLock<HashMap<K, V>>> }

Recommended

struct Bar<K, V> { foo: Arc<DashMap<K, V>>> }

References