lobsters score: 2 · tags: performance, rust
parking_lot uses spin locks internally. I suspect this might be the cause of lackluster performance under contention. Try using
std::sync::RwLockand see if that performs better
score 1 · canonical
See https://github.com/Amanieu/parking_lot/blob/master/src/raw_rwlock.rs#L605 + several other places in this file
score 1 · canonical
This is a normal CAS loop with (exponential) backoff on failed CAS to decrease contention. A spinlock is instead one that spins until a condition is made available by another thread (“blocking” forward-progress guarantee). This one gives up when it would normally block (writer/upgradeable-reader is set) by returning false (“lock-free” forward-progress guarantee).
score 1 · canonical
