Repository navigation
bench: cross-thread fanout, including the case this crate loses - #32
Merged
Merged
Conversation
The in-cache benchmark isolates protocol cost, but it cannot measure a design whose builder owns its consumer threads — there is no single-threaded mode for that shape. Omitting it left the most relevant broadcast comparison missing. This measures the deployed arrangement instead: one producer, N consumer threads on their own cores, 100k messages, every consumer accounting for all of them.
Total milliseconds:
semantics N=1 N=2 N=4 N=8
photon lossless 0.49 0.52 0.58 2.62
sequence-barrier ring lossless 0.45 2.94 6.99 12.15
per-consumer queue lossless 1.39 14.90 27.92 46.79
shared-ring broadcast lossy 8.23 8.61 33.86 119.47
At one consumer the barrier ring wins: there is no contention for a barrier to lose to, and its handler drains a batch where this crate takes messages one at a time. That is in the table. From two consumers onward the positions reverse.
Two things the numbers do not establish, stated with them. The jump in photon's own N=8 figure may be scheduling rather than architecture — nine threads on a sixteen-thread machine that was not idle — and needs a pinned rerun before anyone relies on it. And the shared-ring row is lossy by construction: a receiver that falls behind is told what it missed rather than holding the producer back, so it belongs against this crate's lossy channel() rather than the lossless rows. Writing the benchmark surfaced that; an earlier version asserted lossless delivery for every case and that design cannot provide it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The in-cache benchmark isolates protocol cost, but cannot measure a design whose builder owns its consumer threads — that shape has no single-threaded mode, so the most relevant broadcast comparison was missing entirely. This measures the deployed arrangement: one producer, N consumer threads on their own cores, 100k messages, every consumer accounting for all of them.
Total milliseconds, lower is better:
At one consumer the barrier ring wins. No contention for a barrier to lose to, and its handler drains a batch where this crate takes messages one at a time. That stays in the table. From two consumers onward the positions reverse, and photon holds close to flat through N=4.
Two things the numbers do not establish, published alongside them:
channel(), not the lossless rows. Writing this surfaced it — an earlier version asserted lossless delivery for every case, and that design cannot provide it.Reproduce with
cargo bench --bench fanout_threaded.Verified: 219 tests, clippy clean, fmt clean.