|
| 1 | +# Native Terminal Benchmark |
| 2 | + |
| 3 | +Manual Windows benchmark. Run only in an isolated development worktree. It does |
| 4 | +not connect to an OpenCode service, user profile, or database. |
| 5 | + |
| 6 | +Build from `packages/app` with |
| 7 | +`bun x vite build --config e2e/performance/terminals/vite.config.ts`, then freeze |
| 8 | +`dist` outside the repository. Set `PLAYWRIGHT_BUILD=1`, `PLAYWRIGHT_BASE_URL` to |
| 9 | +an unused loopback URL, `TERMINAL_BUILD` to the frozen build, |
| 10 | +`TERMINAL_ARTIFACTS` to an existing external directory, and `TERMINAL_RESULTS` |
| 11 | +to an external result directory. Run: |
| 12 | + |
| 13 | +```sh |
| 14 | +bun x playwright test --config e2e/performance/terminals/playwright.config.ts --repeat-each=20 |
| 15 | +``` |
| 16 | + |
| 17 | +The runner owns its preview server and each test owns a PowerShell ConPTY process. |
| 18 | +Session metadata is deterministic. Native output is forwarded through Playwright's |
| 19 | +WebSocket fixture into the real production `Terminal`, writer, Ghostty WASM/canvas, |
| 20 | +and serializer. No output is dropped, paused, or delayed. This is native terminal |
| 21 | +plus production renderer evidence, not the production PTY backend or Electron IPC. |
| 22 | + |
| 23 | +The workload is 12,000 colored build/test log lines with file paths, durations, and |
| 24 | +result descriptions. Cases separate visible output, the same output while hidden, |
| 25 | +and closing the session tab after filling the configured scrollback. Ghostty |
| 26 | +converts the app's 10,000-line setting to bytes at its initial 80-column width; |
| 27 | +resizing reduces the effective row capacity. The report records actual retained |
| 28 | +rows and the first retained fixture record rather than assuming 10,000 rows. Completion |
| 29 | +requires the final marker in Ghostty and completion of its write callbacks, not |
| 30 | +just WebSocket delivery. Teardown requires Home readiness and the final serialized |
| 31 | +snapshot. Input, focus, resizing, and native process survival are checked. |
| 32 | + |
| 33 | +`probe.ts` is included only by this benchmark build. It observes actual writes, |
| 34 | +renderer calls, and serialization. Chrome `TaskDuration` measures renderer task |
| 35 | +time, not total process CPU or RAM. For attribution, set |
| 36 | +`OPENCODE_PERFORMANCE_TRACE_DIR`; keep traced runs separate from clean timing. |
| 37 | +`TERMINAL_DRAW_PROBE=1` separately counts actual canvas draws to verify hidden |
| 38 | +rendering; do not mix these instrumented samples with clean timing. |
| 39 | +Use `TERMINAL_REVISION` and `TERMINAL_BUNDLE` to identify frozen artifacts. |
| 40 | +`TERMINAL_SCREENSHOTS` captures the visible result after timing. |
| 41 | + |
| 42 | +The benchmark has no machine-dependent performance thresholds. Keep raw logs, |
| 43 | +snapshots, traces, and screenshots outside Git. Run heavy work through the |
| 44 | +coordinator's exclusive gate when participating in a shared performance wave. |
0 commit comments