Amanieu / parking_lot

Compact and efficient synchronization primitives for Rust. Also provides an API for creating custom synchronization primitives.
Apache License 2.0
2.74k stars 214 forks source link

Update README claims #398

Open dralley opened 1 year ago

dralley commented 1 year ago

The README makes a number of performance claims which haven't been updated in 7 years, in the meantime the standard library has seen a number of improvements made to core concurrency primitives. It would be nice to provide a more up-to-date description of why one may or may not want to use parking_lot.

Particularly this section

This library provides implementations of Mutex, RwLock, Condvar and Once that are smaller, faster and more flexible than those in the Rust standard library, as well as a ReentrantMutex type which supports recursive locking. It also exposes a low-level API for creating your own efficient synchronization primitives.

When tested on x86_64 Linux, parking_lot::Mutex was found to be 1.5x faster than std::sync::Mutex when uncontended, and up to 5x faster when contended from multiple threads. The numbers for RwLock vary depending on the number of reader and writer threads, but are almost always faster than the standard library RwLock, and even up to 50x faster in some cases.

As it's not clear whether those claims are still true.

Amanieu commented 1 year ago

They probably aren't true any more, at least on Linux and Windows where the standard library has a new implementation. If you're willing to re-run the benchmarks, I'll happily accept a PR which rewords the README.

RalfJung commented 1 month ago

Meanwhile without such benchmarks, it would be more honest to remove the claims than leave them stand, IMO.