Comparison between boost lock free and moodycamle queues
Here are comparison between boost lock-free queue and moodycamel queues.
- Multi Consumers and Multi Producers: boost::lockfree::queue , boost::lockfree::stack, and moodycamel::ConcurrentQueue for concurrent access.
- Single Consumer and Single Producer: boost::lockfree::spsc_queue and moodycamel::ReaderWriterQueue.
Observations:
- For single consumer/single producer: moodycamel::ReaderWriterQueue is faster than boost::lockfree::spsc_queue
- For concurrent access, moodycamel::ConcurrentQueue outperforms both boost queue and stack
- For some reason, moodycamel::ConcurrentQueue has better performance when 3 or 4 producers/consumers are used than 1 or 2 threads.
boost::lockfree::queue:
boost::lockfree::queue: Producer threads:1, Consumer threads:1, producer_counter: 10000000, consumer_counter 10000000. Time Taken:2.52799 seconds.
boost::lockfree::queue: Producer threads:2, Consumer threads:2, producer_counter: 10000000, consumer_counter 10000000. Time Taken:2.63741 seconds.
boost::lockfree::queue: Producer threads:3, Consumer threads:3, producer_counter: 9999999, consumer_counter 9999999. Time Taken:2.74344 seconds.
boost::lockfree::queue: Producer threads:4, Consumer threads:4, producer_counter: 10000000, consumer_counter 10000000. Time Taken:2.93172 seconds.
boost::lockfree::stack:
boost::lockfree::stack: Producer threads:1, Consumer threads:1, producer_counter: 10000000, consumer_counter 10000000. Time Taken:2.22722 seconds.
boost::lockfree::stack: Producer threads:2, Consumer threads:2, producer_counter: 10000000, consumer_counter 10000000. Time Taken:2.58529 seconds.
boost::lockfree::stack: Producer threads:3, Consumer threads:3, producer_counter: 9999999, consumer_counter 9999999. Time Taken:2.81599 seconds.
boost::lockfree::stack: Producer threads:4, Consumer threads:4, producer_counter: 10000000, consumer_counter 10000000. Time Taken:3.22939 seconds.
moodycamel::ConcurrentQueue:
moodycamel::ConcurrentQueue: Producer threads:1, Consumer threads:1, producer_counter: 10000000, consumer_counter 10000000. Time Taken:1.49435 seconds.
moodycamel::ConcurrentQueue: Producer threads:2, Consumer threads:2, producer_counter: 10000000, consumer_counter 10000000. Time Taken:1.31297 seconds.
moodycamel::ConcurrentQueue: Producer threads:3, Consumer threads:3, producer_counter: 9999999, consumer_counter 9999999. Time Taken:0.868555 seconds.
moodycamel::ConcurrentQueue: Producer threads:4, Consumer threads:4, producer_counter: 10000000, consumer_counter 10000000. Time Taken:0.810693 seconds.
Single Producer / Single Consumer:
boost::lockfree::spsc_queue:
boost::lockfree::spsc_queue: Producer threads:1, Consumer threads:1, producer_counter: 10000000, consumer_counter 10000000. Time Taken:0.776101 seconds.
moodycamel::ReaderWriterQueue:
moodycamel::ReaderWriterQueue: Producer threads:1, Consumer threads:1, producer_counter: 10000000, consumer_counter 10000000. Time Taken:0.586292 seconds.
Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your blog? My blog site is in the exact same area of interest as yours and my visitors would genuinely benefit from some of the information you present here. Please let me know if this alright with you. Thank you! cheap elo boost
ReplyDeleteI recently found your blog and have already been reading along. I believed I could leave my first comment. I don't understand what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.duo queue boost
ReplyDelete