You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# Inter-thread Communication Benchmark
|
|
|
|
|
|
|
|
This code tests the best way to collaborate between threads
|
|
|
|
|
|
|
|
## Platform tested:
|
|
|
|
- Windows (MSVC, gcc-12.2, WSL-gcc11.2, WSL-clang-14)
|
|
|
|
- macOS (clang-13, gcc-12.2)
|
|
|
|
- Linux (gcc-12.1, gcc-11.3, clang-12)
|
|
|
|
- arm64 Linux (gcc-12.1, clang-12)
|
|
|
|
|
|
|
|
## Method tested:
|
|
|
|
- C++20 std::semaphores
|
|
|
|
- Native semaphores
|
|
|
|
- Condition Variables
|
|
|
|
- Busy waiting (spinlock) with or without delay
|
|
|
|
|
|
|
|
## Results:
|
|
|
|
```
|
|
|
|
macOS linux win, msc win, gcc
|
|
|
|
cv 6000 10000 700 26000
|
|
|
|
busy 360 300 550 300
|
|
|
|
nsmph 600 4418 6000 1200
|
|
|
|
smph 240 1000/dl 660 dl
|
|
|
|
```
|
|
|
|
Bug on g++ 12.2.0 might cause deadlock, see: gcc12.2.0deadlockbug.cpp
|