#60

serve: reach the PTY ceiling (≥160 MB/s) on every workload

Openbettercleveropened 5d ago

Follow-up to #56 / #57. With #57's worker-thread PTY reader, wraithterm serve measures 97–134 MB/s median through scripts/ghostty-native/run.mjs at 160×50 (macOS, M5 Max). A blocking reader on a dedicated thread reaches ~185 MB/s on the same PTY (scripts/ghostty-native/pty-ceiling.py), and the engine alone parses 290–1,100 MB/s, so serve's own pipeline (reader thread wakeups, copies, main-thread WebSocket writes) leaves throughput on the table.

Goal

Bring serve close to the PTY ceiling on every workload, without costing interactivity or idle CPU.

Acceptance criteria

  • run.mjs (logs, ASCII, DOOM text 30 MB, DOOM Kitty 60 MB at 160×50) reports serve at ≥160 MB/s median on all four workloads, or the PR documents, with measurements, which stage caps it below that.
  • A/B against the #57 baseline is interleaved in the same session (baseline/change alternating), with medians, ranges and load averages; raw JSON and a short report under docs/benchmarks/serve-pty-ceiling/. Numbers are labelled provisional (shared machine).
  • Keystroke echo (scripts/ghostty-native/echo.mjs) p50/p90 not materially worse than baseline, measured A/B.
  • Idle serve CPU with an idle shell stays below 1%.
  • Session exit still delivers late output and [session ended]; backpressure still pauses the PTY; Windows keeps node-pty's reader.
  • npm run test:serve passes; benchmark scripts accept a port so they do not collide with other runs.
  • Ideas that did not help are reported as negative results.

Activity

0

No activity yet.