Cost
What the framework's own code costs per message, measured in instructions and allocations, and where the cost goes.
AMD Ryzen 9 7900X 12-Core Processor, x86_64 (x86-64-v4), base unknown, min 427 MHz, max 5912 MHz, 12 physical, 24 logical, 62.4 GiB, unknown, Linux 7.3.0-3-moloko, 1.99.1, 3.25.1, bench, inheriting release (opt-level = 3, lto = fat, codegen-units = 16, debug = line-tables-only), --no-default-features --features memory,macros,json,tokio. ruststream 0.8.0, measured 2026-11-01.
Show the numbers as a table
| Scenario | Instructions | Allocations | Cold start |
|---|---|---|---|
| consume, JSON decode into a small struct | 1,697.4 | 0 | 16,282 / 26 |
| consume, JSON decode of a 1 KB body | 17,304.2 | 0 | 32,028 / 26 |
| consume on the byte lane, no codec | 862.4 | 0 | 15,563 / 26 |
| consume through a pool of four workers | 3,131.8 | 0 | 29,529 / 43 |
| consume on four dedicated threads | 461.4 | 0 | 56,438 / 133 |
| consume through a middleware stack of one | 1,742.3 | 0 | 16,700 / 26 |
| consume through a middleware stack of four | 1,785.3 | 0 | 16,742 / 26 |
| consume in batches of 64 | 1,516.2 | 0 | 18,273 / 28 |
| consume in batches of 64 through a pool of four workers | 1,538.8 | 0 | 33,921 / 45 |
| reply, encoded to a declared destination | 2,583.4 | 1 | 18,881 / 28 |
| reply to a transport that reads the payload | 2,051.4 | 0 | 18,136 / 29 |
| publish through an Out slot with one transform | 3,143.4 | 2 | 19,056 / 29 |
| publish through an Out slot to a transport that reads the payload | 2,570.4 | 1 | 18,907 / 31 |
| publish with a typed header contract | 3,589.4 | 4 | 19,789 / 31 |
| read a typed header contract, then publish | 3,972.3 | 1 | 19,464 / 28 |
| request and reply, one round trip | 8,920.9 | 10 | 24,823 / 36 |
| a continuation left behind by every delivery | 3,456.6 | 2 | 17,781 / 28 |
| a delivery that asks to be redelivered, natively by the broker | 3,270.5 | 0 | 17,914 / 26 |
| a delayed redelivery the runtime publishes as a copy | 9,531.1 | 6 | 25,096 / 32 |
The numbers are the steady state per message, on the in-process broker, so no transport is in them. A row shows its cold start on hover or focus: what starting the service and handling the first delivery cost together, paid once.
Taking a delivery allocates nothing. The loop keeps one slot for the delivery and one encode
buffer, and every stage is a generic type resolved at compile time, with no dynamic call on the
way. A DynStack of layers chosen at run
time costs one boxed future per layer per message. An
and_after continuation is one boxed future,
paid only by the delivery that sets it.
A reply allocates nothing when the broker's client only reads the bytes: it is lent the loop's buffer. The in-process broker keeps what it is handed, so its reply costs the buffer the codec wrote. The other publish rows allocate what the in-process broker keeps of each message, and what the scenario builds itself: a header value, or a request's single-use inbox.
The payload's size is the expensive part of a decode: compare the 1 KB body with the small struct. The benchmarks publish every scenario with its method, against each broker's raw client too.