C++ Multithreaded Count Benchmark
Briefly

Using C++11 mutex to synchronize count threads. Benchmark result: inc mutex: 3136ms.
Replacing mutex with C++11 atomic integer shows over 66% performance improvement. Benchmark: inc mutex: 3136ms, inc atomic: 1007ms.
Pre-C++11 on Windows can utilize InterlockedIncrement for performance gain. Benchmark: inc mutex: 3136ms, inc atomic: 1007ms, inc win Interlocked: 1005ms.
Introducing lockless benchmark using loop::parallel_for instead of C++17 std::for_each. numOfThreads options: 0 for no thread, 1 for current thread, -1 for thread spawning.
Read at CodeProject
[
|
]