Conversation
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.
Summary
SPMC used a producer waiter queue even though
send(&mut self)permits only one pending send. Replace that queue with one waker slot, and carry the exclusive producer capability into the implementation. Add cancellation, notification-race, reentrant-callback, and payload-destruction tests, plus SPMC primitive benchmarks.Validation:
cargo x test,cargo x check,cargo x lint, andcargo x miri. All 28 SPMC tests pass normally; Miri passes 26, with the two existing Tokio runtime tests excluded.Design Notes
try_sendfast path. Pending sends reuse the single waker slot; receiving checks the queue and registers interest in one critical section. Unbounded publication has no capacity check orFullpath.Local measurements on Apple M4 Max, rustc 1.99.0-nightly (3d6c19bb9), against
f998f35with the same benchmark cases. Values are medians of five run medians, alternating old/new execution order.For the existing 16,384-message task batch with four runtime workers:
The gains are concentrated in waiting and competing-consumer workloads; this is not a universal throughput improvement. In particular, the unbounded single-consumer task batch regressed in these local measurements. Current-thread task-batch changes ranged from -4.7% to +2.0%.