4 ms·
SRWLock perf is slightly better than Window WaitOnAddress stuff, and works on older versions of windows.
by Wumpnot 2y ago
SRWLock perf is slightly better than Window WaitOnAddress stuff, and works on older versions of windows.
- tialaramex 2y agoI find this unlikely. Do have some real world evidence for this? Microbenchmarks are not at all useful for this stuff in my experience. For speed: In the uncontended case, which is what we mostly care about because if you're contended it's game over for speed, they're both a single atomic CAS, so that's no difference. In terms of size, the pointer is bigger than you'd want - it's no pthread_mutex or the analogous Windows data structure where it's a multi cache line disaster of a data structure - but it's clearly worse than a futex or WaitOnAddress solution.
- Wumpnot 2y agoA few years ago I compared them, it was not a microbenchmark, but a real application. There were a few million(almost entirely uncontended) exclusive locks being taken on startup, SRWLock was consistently faster, though the difference was not large.
- tialaramex 2y agoThanks, I wonder what that's all about.