#rust question: When is it still a good idea to use parking_lot rather than the standard library's Mutex, RwLock, and so on? My understanding is that parking_lot became much less necessary when Rust 1.62.0 introduced thinner, faster mutexes on Linux, and 1.63.0 made the constructors const. And if one only has a small number of mutexes, I suppose the overhead of the parking lot would dominate. Has anyone written a post in the past year or so weighing the pros and cons?
modulux reshared this.
Kornel
in reply to Matt Campbell • • •Natalie
in reply to Matt Campbell • • •appears to be some benchmarks on a tracking issue:
https://github.com/rust-lang/rust/pull/95035#issuecomment-1073966631
TL;DR doing better in the no/light contention categories, ~100us worse than parking lot, impoved from 2ms worse before the changes. Outperforms everything they tests in heavy/extreme contention
Going off that i think std sounds like a good default, the only performance situation I can think of are massive datasets where the lock is more expensive than the calculation performed. That or having unpoisoned locks
Replace Linux Mutex and Condvar with futex based ones. by m-ou-se · Pull Request #95035 · rust-lang/rust
GitHub