2022-11-02 05:14:41 +08:00
2022-11-02 05:00:09 +08:00
2022-11-02 05:00:09 +08:00
2022-11-02 05:14:41 +08:00
2022-11-02 05:00:09 +08:00

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

S
Description
No description provided
Readme
120 KiB
Languages
C++ 79.1%
Python 20.9%