35311690
Input-latency bench: cold child is cat > /dev/null
a73x 2026-04-18 06:42
Switch from sleep infinity to cat > /dev/null for the cold scenario. Same kernel-echo behavior, but drains the PTY slave's input buffer so samples can scale arbitrarily without buffer-fill risk. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
diff --git a/docs/superpowers/specs/2026-04-18-input-latency-bench-design.md b/docs/superpowers/specs/2026-04-18-input-latency-bench-design.md index bf6c94f..a8716bb 100644 --- a/docs/superpowers/specs/2026-04-18-input-latency-bench-design.md +++ b/docs/superpowers/specs/2026-04-18-input-latency-bench-design.md @@ -23,7 +23,7 @@ New env var `WAYSTTY_INPUT_BENCH={cold|hot|both}` activates input-bench mode. When active, waystty: 1. Spawns a minimal PTY child instead of `$SHELL`: - `cold` → `sleep infinity`. Kernel PTY line discipline echoes each byte (ECHO flag on the slave); no reader needed. This removes `cat`'s canonical-mode buffering as a confound. - `cold` → `cat > /dev/null`. Reads and discards stdin so the PTY slave's input buffer stays drained; kernel PTY line discipline echoes each byte (ECHO flag on the slave). Cat's canonical-mode buffering is irrelevant — we measure kernel echo, not cat's reads. - `hot` → `sh -c 'yes "spam spam spam spam spam"'`. Continuous output contends with sentinel echo bytes on the PTY. - `both` → runs cold, dumps stats, restarts child, runs hot. 2. Disables real Wayland keyboard input (nothing is pushed to `keyboard.event_queue` from `src/wayland.zig`). Protects measurements from ambient user input or stuck modifier state. @@ -142,4 +142,4 @@ Mirrors the existing `bench` / `profile` targets: `OPT` defaults to `ReleaseFast - **`wp_presentation_time` binding is non-trivial.** Neither the global nor the feedback callbacks exist in the repo. Budget real time for this, including the WSI-commit coordination (feedback request must precede `vkQueuePresentKHR`). - **Mesa Wayland WSI internals.** Confirm empirically that `wp_presentation.feedback(surface)` called immediately before `vkQueuePresentKHR` attaches to the driver's commit. If not, we may need `VK_KHR_present_wait` or a different coordination strategy. - **`sleep infinity` tty state.** Confirm kernel echoes bytes on a PTY whose slave-side reader is `sleep` (which doesn't open the tty in any special mode). If echo is off, `stty echo` on the slave fd before exec resolves it. - **PTY termios state.** Confirm the default termios on the spawned child's slave fd has `ECHO` set so kernel echo works without an explicit `stty echo`. If not, call `tcsetattr` on the slave before exec.