diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2023-09-20 09:02:50 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-09-20 09:03:36 -0700 |
commit | 28549d18f7190c59fa5b9eaf4530e15f3f0d521f (patch) | |
tree | 259931b54b8dd5ac4a87a36a321e6ac343760e86 /absl/synchronization/mutex_benchmark.cc | |
parent | 556fcb57eb5f87e137c7db39b5a60ab3c4aa525f (diff) | |
download | abseil-28549d18f7190c59fa5b9eaf4530e15f3f0d521f.tar.gz abseil-28549d18f7190c59fa5b9eaf4530e15f3f0d521f.tar.bz2 abseil-28549d18f7190c59fa5b9eaf4530e15f3f0d521f.zip |
absl: speed up Mutex::ReaderLock/Unlock
Currently ReaderLock/Unlock tries CAS only once.
Even if there is moderate contention from other readers only,
ReaderLock/Unlock go onto slow path, which does lots of additional work
before retrying the CAS (since there are only readers, the slow path
logic is not really needed for anything).
Retry CAS while there are only readers.
name old cpu/op new cpu/op delta
BM_ReaderLock/real_time/threads:1 17.9ns ± 0% 17.9ns ± 0% ~ (p=0.071 n=5+5)
BM_ReaderLock/real_time/threads:72 11.4µs ± 3% 8.4µs ± 4% -26.24% (p=0.008 n=5+5)
PiperOrigin-RevId: 566981511
Change-Id: I432a3c1d85b84943d0ad4776a34fa5bfcf5b3b8e
Diffstat (limited to 'absl/synchronization/mutex_benchmark.cc')
0 files changed, 0 insertions, 0 deletions