Repository navigation
perf(mpsc): reduce intermediate copies in bounded receives - #407
sanjay7178 wants to merge 4 commits into
Conversation
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
orthur2
left a comment
There was a problem hiding this comment.
Thanks for working on this. The receive-side change looks good to me, but I'd drop the send-side part.
Benchmark follow-upRemoved the send hunk as requested; the implementation change now only simplifies receive result handling. The earlier combined before/after measurements did not establish the cause of the contended timing change. Measured on Linux x86-64 (AMD EPYC-Rome VM, 16 CPUs), rustc 1.99.1 / LLVM 23.1.1, optimized Cargo bench builds. All four variants use base Each cell is median ms (min–max); lower is faster.
The isolated ready case supports dropping the send change on this host. Contended timings remain noisy and platform-dependent; these data do not establish a lock-timing mechanism or resolve #401. The Raw recorded times in chronological order within each variant (ms) |
Summary
Reduce intermediate payload copies in bounded MPSC receives by removing the payload/waker tuple from the receive path. Add matched inline and boxed benchmarks and ownership tests for cancellation, disconnection, and resumed sends.
A balanced four-variant benchmark on Linux x86-64 measured the retained receive-only change at 230.5 ms versus 250.5 ms for the inline ready case (16 samples per variant). Contended inline medians were 730 versus 747 ms with broadly overlapping ranges; this does not establish a significant contended throughput improvement. The send-side change has been removed following review. Full methodology and raw samples are in the benchmark follow-up comment.
Related to #401; further work is needed to close the larger throughput gap.
Validation
cargo x lint.