Open cjappl opened 1 year ago
Am indeed curious about the hang. Could it possibly be just very, very slow? The std::queue
-based implementation is dead simple.
Alright, there's gotta be some UB or something going on here. I changed the test matrix such that this was the only test that ran (empty queue on std::queue)
const bool QUEUE_BENCH_SUPPORT[QUEUE_COUNT][BENCHMARK_TYPE_COUNT] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
Running this suite by itself hangs indefinitely, or takes >1hr to return, however just modifying it to this:
Runs successfully (results posted here, including the test previously commented out)
Hooking it up to a profiler, it seems that the test is basically just spinning asking the system what time it is?
I know from audio land that introducing a system call can force data races to resolve. Is there anything in this specific test case you would consider not thread safe? Or any UB? I should probably try to run with some sanitizers..
Best guess: something might be so fast it's taking 0 ns :-)
Let me know if you want me to dig into anything more, otherwise feel free to close this and the readerwriterqueue issue as complete.
Happy to profile again in the future if it'd be helpful.
👍 Thanks for your help! Will leave these open for now until I have a chance to look more deeply at the results (could be a while!). Don't think you need to explore more on your end (unless you want to, of course).
Sounds like a plan! Ping me if you need me.
Hello, me again!
I just ran the profiling on my M1, figured you may want to check out the results
https://gist.github.com/cjappl/6277bb149ad356dc48ec312188a8e757
Note: I had to comment out
bench_empty_dequeue
as it was hanging onstd::queue
. I can investigate if you're curious and want those values in the results