Skip to content

refactor: simplify unbounded MPSC and consolidate validation - #293

Merged
tisonkun merged 26 commits into
apache:mainfrom
tisonkun:codex/simplify-unbounded-mpsc
Sep 9, 2026
Merged

refactor: simplify unbounded MPSC and consolidate validation#293
tisonkun merged 26 commits into
apache:mainfrom
tisonkun:codex/simplify-unbounded-mpsc

Conversation

@tisonkun

@tisonkun tisonkun commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Keep unbounded MPSC endpoint state under one mutex and replace receiver waker registration retries with a linear path. Preserve receiver-local batches, FIFO, cancellation, and incremental storage reclamation while removing the spare-segment cache; organize endpoint definitions with their implementations and clarify delivery contracts.
  • Consolidate shared integration-test wakers, polling, and deadlock checks. Establish pending waiters deterministically, verify complete MPSC message sets, remove subsumed tests, and keep necessary reclamation checks next to their state.
  • Remove avoidable benchmark adapter allocation and incomplete worker round trips. Consolidate duplicate suites and reduce parameter matrices while retaining representative scheduling, backpressure, payload, and backlog scenarios.
  • Add cargo x bench --no-run and compile benchmarks in the existing required check job. Local cargo x bench continues to run measurements on demand.

Validation: cargo x test (485 passed), cargo x check, cargo x lint, cargo x miri (89 passed; three OS-runtime cases skipped by the existing configuration), cargo x bench --no-run, and both benchmark binaries with --test to run every retained case once. Independent test and benchmark reviews found no remaining actionable issues.

Design Notes

The receiver still consumes its local batch without locking. Sender clone/drop now uses the shared mutex: local M4 Max measurements show about 5.5 ns additional cost per clone/drop pair and 1 ns per ready send/receive pair. Scheduled scalar batches were roughly unchanged; eight OS-thread producers with a blocking receiver were 12% slower, while eight-producer inline 1 KiB bursts were 13% faster. These are five-round local medians across 16 representative cases, with concurrent scheduling noise, rather than performance guarantees.

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun changed the title refactor(mpsc): simplify unbounded channel coordination refactor: simplify unbounded MPSC and consolidate validation Sep 9, 2026
@tisonkun
tisonkun merged commit 7092326 into apache:main Sep 9, 2026
10 checks passed
@tisonkun
tisonkun deleted the codex/simplify-unbounded-mpsc branch September 9, 2026 13:39
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.

1 participant