newsched icon indicating copy to clipboard operation
newsched copied to clipboard

Debug Queue Performance

Open mormj opened this issue 2 years ago • 2 comments

The moodycamel queue when nthreads >> ncores is really inefficient. Either go back to the std::dequeue implementation, or figure out how to tune performance

// The number of times to spin before sleeping when waiting on a semaphore.
// Recommended values are on the order of 1000-10000 unless the number of
// consumer threads exceeds the number of idle cores (in which case try 0-100).
// Only affects instances of the BlockingConcurrentQueue.
static const int MAX_SEMA_SPINS = 0; //10000;

mormj avatar Apr 27 '22 16:04 mormj

C++ 20 has std::atomic_flag with waiting methods - if we can move to that there should be a performance gain. See: https://modernescpp.com/index.php/performancecomparison-of-condition-variables-and-atomics-in-c-20

mormj avatar Apr 27 '22 19:04 mormj

https://github.com/facebook/folly/blob/main/folly/MPMCQueue.h

mormj avatar Jun 16 '22 13:06 mormj