Issue #2869: Each wait on the I/O worker allocates once under the default io-method

Open and answer this issue on GitHub.

bug, ready · opened 2026-11-28 · updated 2026-11-28 · 0 comments

Found while “io::lines() reads into a fixed pool and yields views” (#2851), builder’s step 4 report, at 471b3124.

Probe

for line in io::lines() { n += 1; total += line.len() } over 100 000 lines (3 685 944 bytes) on standard input, counted with mem::allocations() on the main thread:

The pool allocates nothing per chunk: the bytes are reused through Arc::get_mut, the keep slot is inline and the reply channel is kept for the loop. So the allocation is in the executor’s wait for the I/O worker’s answer.

Governing decision

ADR-stream-buffers-v1 D1 (a fixed pool, no allocation in steady state) and D9. The figure in the ADR index assumes no allocation per refill.

Cause

Unknown. Suspected in crates/nikaia-std/src/rt/exec.rs, in block_on’s park under io_uring (a waker or a future boxed per wait). Settle it by counting mem::allocations() around one time::sleep(1.millis()) under the default io-method, or with callgrind once valgrind can run such a program (docs/measuring.md: it hangs on stdin there).

To build

  1. Find the allocation per wait and remove it (for example with a reused waker or future slot). Test: tests/compiler/tests/a_wait_on_the_io_worker_allocates_nothing.nika, .stdout, which prints the allocations counted around 100 waits as 0.

Done when

The test passes, and the #2851 loop under the default io-method allocates no more than under blocking (9 for 100 000 lines). The commit carries Fixes #N and the figures.

Files and limits

crates/nikaia-std/src/rt/exec.rs and the runtime Rust around it (platform layer, ADR-platform-layer-v1). List the Rust for #557 / #125.

Facts: Measuring

Back to Open Issues