Skip to content

Conversation

@mgeier
Copy link
Owner

@mgeier mgeier commented Oct 27, 2025

In my quest for more realistic/relevant benchmarks, I have created two more benchmarks. Both of them use two threads (as before) and two queues each. The second thread simply "echoes" every item back to the first thread.

One of the benchmarks tries to keep both queues as full as possible by always pushing as many items as possible, while only popping one:

eager-push

The other benchmark does the opposite, in that it tries to keep the queues as empty as possible by always popping as many items as possible, but only pushing one:

eager-pop

Except for very short queues, the actual capacity doesn't have much of an influence (the capacity is currently set at 4096).

What stands out to me in the above results is that the crossbeam queue is much worse than the rest with a big margin (as I would have expected in the very beginning, but the other benchmarks - included below - don't show a big margin, it is even sometimes better than ringbuf). There is no real difference between rtrb and omango, contrary to the old benchmarks. In both old and new, ringbuf is the slowest SPSC queue. There seems to be no real difference between eager pushing and eager popping, but I don't really know if I should have expected any ...

Any other insights?

Are there any suggestions for improvements?

If somebody wants to try the new benchmarks on their own machines, go ahead, and if possible, please share the results here!

For reference, the two old benchmarks are still there:

large

small

@mgeier
Copy link
Owner Author

mgeier commented Nov 1, 2025

I wrote:

Except for very short queues, the actual capacity doesn't have much of an influence

But you shouldn't have to take my word for it, so I added a commit which allows measuring multiple queue sizes and comparing them: 15c2b52?w=1 (easier to read when ignoring whitespace).

As is, this still only uses a single length of 4096, but it's easy to add more sizes manually, which will in turn create line plots like these:

eager-push-line

eager-pop-line

It still creates violin plots (a lot of them), which are still useful to get an idea about the statistical significance of the individual measurements:

eager-push-violin
eager-pop-violin

@mgeier mgeier merged commit 15c2b52 into mgeier:main Nov 7, 2025
9 checks passed
@mgeier mgeier deleted the two-queue-benches branch November 7, 2025 19:35
@boranby
Copy link

boranby commented Nov 11, 2025

eager-pop
eager-push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants