News for hackers. Stuff that matters.
Re:Mutexes are faster than Spinlocks by gok on Saturday January 04, 2020 @11:37AM (#21955788)
Note that all of the locks tested here are unfair, which is why they all show very high waiting variance. Until recently many mutex implementations aimed for fairness, which made them much slower than spinlocks in microbenchmarks like this.
Re:Mutexes are faster than Spinlocks by Diggsey on Saturday January 04, 2020 @12:33PM (#21956132)
Actually, the parking_lot mutex is fair: https://docs.rs/parking_lot/0.10.0/parking_lot/type.Mutex.ht...

The high waiting variance is because the benchmark randomly decides which locks to take, meaning that the amount of contention is variable.

Re:Mutexes are faster than Spinlocks by sanxiyn on Saturday January 04, 2020 @01:20PM (#21956414)
Note that fair locking is still expensive. parking_lot achieves both speed and fairness by starting with unfair locking and falling back to fair locking.
Re:Mutexes are faster than Spinlocks by matklad on Saturday January 04, 2020 @06:05PM (#21958265)
Benchmark uses fixed seeds, there’s no inherent randomness.