Unverified Commit 69279a84 authored by Hui's avatar Hui Committed by GitHub
Browse files

[libc++][test] add benchmarks for `std::atomic::wait` (#70571)

For the mutex vs atomic  test:

Old: `unique_lock<mutex>`
New: a lock implemented with `atomic::wait`

On 10 years old Intel Macbook, `atomic::wait` is 50% slower than `mutex`

```
Benchmark                                             Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------
BM_multi_thread_lock_unlock/1024                   +0.3735         +2.4497       1724726       2368935        153159        528354
BM_multi_thread_lock_unlock/2048                   +0.4174         +1.2487       3410538       4834012        435062        978311
BM_multi_thread_lock_unlock/4096                   +0.5256         +1.9824       6903783      10532681        590266       1760405
BM_multi_thread_lock_unlock/8192                   +0.5415         +0.4578      14536391      22408399      ...
parent 0fb3d429
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment