concurrentqueue icon indicating copy to clipboard operation
concurrentqueue copied to clipboard

M1 profiling results

Open cjappl opened this issue 2 years ago • 6 comments

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 on std::queue. I can investigate if you're curious and want those values in the results

cjappl avatar Feb 28 '23 00:02 cjappl

Am indeed curious about the hang. Could it possibly be just very, very slow? The std::queue-based implementation is dead simple.

cameron314 avatar Mar 01 '23 17:03 cameron314

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: Screen Shot 2023-03-02 at 11 52 00 AM

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? Screen Shot 2023-03-02 at 11 54 33 AM

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..

cjappl avatar Mar 02 '23 20:03 cjappl

Best guess: something might be so fast it's taking 0 ns :-)

cameron314 avatar Mar 02 '23 21:03 cameron314

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.

cjappl avatar Mar 02 '23 21:03 cjappl

👍 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).

cameron314 avatar Mar 05 '23 17:03 cameron314

Sounds like a plan! Ping me if you need me.

cjappl avatar Mar 05 '23 19:03 cjappl