#!/usr/bin/env node /** * Cross-terminal pipeline benchmark. Run INSIDE the terminal under test * (Orca pane, iTerm2, Ghostty, Terminal.app, VS Code, ...) — it measures the * full byte path of whatever terminal hosts it: PTY -> (daemon/ptyHost -> * IPC ->) parser -> response. * * Metrics per run: * 1. dsr-idle — DSR (ESC[6n) round-trip latency at rest. The reply is * produced only after the terminal's parser reaches the * query, so this tracks the input/echo pipeline without * needing OS-level keystroke injection. * 2. throughput — wall time to stream each fixture, ended by a DSR * fence. The fence matters: xterm.js-class terminals * ingest at wire speed into an internal queue and parse * later, so socket drain alone would flatter them. * 3. dsr-under-load — DSR latency sampled while a paced (default 1 MB/s) * agent-TUI stream plays. This is the "typing while an * agent floods output" complaint, quantified. * * Usage (run in EACH terminal being compared, same machine, on AC power): * node tests/tools/benchmarks/terminal-pipeline-bench.mjs --label m2max-2026-07-02 * [--size-mb 10] [--iterations 5] [--dsr-count 200] [--skip-load] * [--fixtures ascii-log,cjk-emoji,agent-tui,styles-stress] * * Aggregate results from all terminals into one comparison table: * node tests/tools/benchmarks/terminal-pipeline-bench.mjs report [--label ] * * Protocol notes: keep hands off the keyboard during a run (stdin is parsed * for DSR replies), use a comparable window size everywhere, avoid tmux/screen * (they proxy the queries and would be the thing measured). `styles-stress` is * deliberately pathological (every cell restyled); read it as a ceiling probe, * not a realistic workload. Complementary manual metric: Typometer for true * keypress->pixel latency — this probe stops at the parser reply. * Results: tests/tools/benchmarks/results/terminal-pipeline-