notes

Buffering: measured, and the answer is to build nothing

An appendix to nifeos/nife:notes/pipes.md, which is the page to read. This file holds the 2026-08-03 throughput measurement against a Unix pipe, what it says, and its caveats. It moved here as the index says.

The records this file cites by number:

Buffering: measured, and the answer is to build nothing

The roadmap block said it plainly: measure a | b throughput against a Unix pipe before deciding anything. If buffering earns its place, it arrives as a component speaking the sink contract on both sides. The measurement came on 2026-08-03. It has not earned its place, and the number says something more useful than "no".

The measurement

bench: sink_throughput (kernel/src/bench.rs) is a pipeline with the shell taken out: two EL0 processes, one endpoint, the left one packing sixteen bytes into a sink message and SENDing, the right one RECEIVEing and self-timing. bench/host/pipe_throughput.rs is the same shape over a real pipe(2), twice, because only one of the two arms is apples to apples.

Apple Silicon, one machine, one sitting. nife under HVF (cargo xtask bench --real), so the nanoseconds are real; the host arms are medians of three.

per 16 bytes throughput
nife a | b (one endpoint, no buffer) 1146 ns 13.3 MiB/s
macOS pipe, 16-byte writes 348 ns 44 MiB/s
macOS pipe, 64 KiB writes (5.4 µs per 64 KiB) 11,600 MiB/s

Two reference points from the same run make the first row legible. ipc_rtt_el0 is 2785 ns for a round trip, so a one-way rendezvous is about 1.4 µs. Our pipe is one rendezvous per message and nothing else: there is no overhead to find. And relay_rtt (1187 ns) against ipc_rtt (2313 ns) prices what a hop through a userspace process costs, which is roughly double.

What the numbers actually say, which is not what the block expected

The lockstep is not the bottleneck. The sixteen-byte message is.

Read the two host rows together. At the same granularity Unix is 3.3x faster than us, which is a real gap and is the cost of a capability rendezvous against a tuned kernel pipe. The 870x is somewhere else entirely. Unix's win is that a program writes 64 KiB per system call, while the register-only sink contract caps ours at sixteen bytes per message.

That cap is not an oversight and it is not a thing buffering fixes. notes/sink-protocol.md records why the contract had to be register-only: the moment a sink also needs a page mapped at an agreed address, redirection stops being "put a different capability in one slot" and becomes a three-way spawn-time negotiation, and milestone 50's whole finding evaporates.

So a buffering component would make it worse, and that is the decision

Insert a process between the two ends and every message pays a second rendezvous. relay_rtt prices that at roughly double, so an 80 KB pipeline would go from 5.7 ms to something near 11 ms. A buffer cannot batch its way out of that, because what it forwards is still sixteen bytes per message. The contract it speaks on both sides is the one that sets the cap.

Buffering buys decoupling, not bandwidth. It wins when a producer has work to do between writes and a consumer has work to do between reads, so the two can overlap instead of alternating. It does not win when both are only moving bytes, which is what this benchmark and every pipeline in this system today are.

So nothing is built, and that is the successful outcome the block described. What would move the number is a larger message, and that is a different decision with §51's indifference on the other side of it. It is not taken here and it is not needed. date | wc and ls | wc are hundreds of bytes, and at 1.15 µs per sixteen that is tens of microseconds for a whole line.

The honest caveats