You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve bounded MPSC throughput for inline 1 KiB messages #401
The reproducible gap is four producers and one consumer on four Tokio runtime workers, using 64 queue slots. Each timed batch transfers 16,384 inline [u8; 1024] values. Both four-library launches put Asyncband fourth.
Apple M4 Max, macOS arm64, rustc 1.101.0-nightly. Each cell gives rank, elapsed time relative to Asyncband and the whole-batch median over 10 interleaved runs. Lower is faster. Ecosystem measurements
With topology and batch count fixed, Asyncband and Tokio took 23 and 39 ms for usize, 304 and 78 ms for inline 1 KiB, and 106 and 89 ms for the same bytes in a Box. Calling reserve before every Asyncband send still took 303 ms for inline values. Stack samples showed mutex waits and memmove in the send path. In another matched run, changing only the internal lock reduced Asyncband from 306 to 189 ms, with Tokio at 83 ms. The queue moves values into and out of a shared VecDeque under its state lock.
First contribution
Reproduce the inline row, then profile send and receive separately with inline and boxed payloads. Look for copies or time under the queue lock. Validate a candidate with ordinary usize traffic, a full queue and cancelled reservations. Preserve delivery order, backpressure and the exact requested capacity.
The one-producer usize case at capacity 1024 is a variability control at 430 fixed rounds. Flume won its original run (210 ms vs Asyncband's 366 ms), and Asyncband won the repeat (194 ms vs 213 ms). It has a different payload and topology. Both four-library rankings
Reproduced the inline row and the boxed control on Apple M5 (10 cores), macOS 27.0.1, rustc 1.99.1 stable, in a disposable checkout of b1354ae (current main), cargo x bench --bench ecosystem, --rounds 26 --repeat 10, medians with min..max.
Payload
Asyncband
Tokio
async-channel
flume
inline 1 KiB
264 ms (259..267)
87 ms (86..88)
157 ms (153..181)
273 ms (268..283)
boxed 1 KiB
126 ms (123..128)
94 ms (94..95)
117 ms (102..129)
129 ms (126..137)
The orderings differ from the issue's host only in the last two places: there flume was third and Asyncband fourth; here Asyncband is third (264 ms) and flume fourth (273 ms). With the payload boxed, the gap to Tokio narrows from 3.03x (264/87) to 1.34x (126/94), async-channel moves to 117 ms, and all four implementations land within 1.37x of Tokio (async-channel 1.24x, Asyncband 1.34x, flume 1.37x) — the same direction as the issue's own Box measurement (106 vs 89 ms on M4 Max).
Two of the issue's other controls bracket this on its host: with usize payloads Asyncband took 23 ms against Tokio's 39, and switching only the internal lock moved the inline row from 306 to 189 ms with Tokio at 83 — that substitution alone recovers roughly half of the 306−83 ms gap; the issue's stack samples attribute much of the row's remaining time to memmove in the send path, under the queue lock.
Activity
nanami-0713 commentedon Nov 10, 2026
Reproduced the inline row and the boxed control on Apple M5 (10 cores), macOS 27.0.1, rustc 1.99.1 stable, in a disposable checkout of
b1354ae(current main),cargo x bench --bench ecosystem,--rounds 26 --repeat 10, medians with min..max.The orderings differ from the issue's host only in the last two places: there flume was third and Asyncband fourth; here Asyncband is third (264 ms) and flume fourth (273 ms). With the payload boxed, the gap to Tokio narrows from 3.03x (264/87) to 1.34x (126/94), async-channel moves to 117 ms, and all four implementations land within 1.37x of Tokio (async-channel 1.24x, Asyncband 1.34x, flume 1.37x) — the same direction as the issue's own Box measurement (106 vs 89 ms on M4 Max).
Two of the issue's other controls bracket this on its host: with
usizepayloads Asyncband took 23 ms against Tokio's 39, and switching only the internal lock moved the inline row from 306 to 189 ms with Tokio at 83 — that substitution alone recovers roughly half of the 306−83 ms gap; the issue's stack samples attribute much of the row's remaining time tomemmovein the send path, under the queue lock.The in-tree commands used:
Performance tracking issue #396