Read Locks Are Not Your Friends
Summary
This article investigates why read locks can underperform in read-heavy workloads when using Rust’s RwLock. Through benchmarks on Apple Silicon M4 and a high-performance tensor cache, it shows that cache line contention and atomic counter updates can make read locks slower than write locks, and it provides practical guidance on profiling and alternative locking strategies.