#67
Fleet: 60 fps per terminal at 1,000 live terminals
Fleet (#54) draws 1,000 live terminals through one shared WebGPU surface per worker, but at 1,000 streaming terminals the measured rate is 41–49 parsed updates per terminal per second (p10 38–46) with display rAF at 69–84/s on an Apple M5 Max at 120 Hz (REPORT). The report attributes the limit to the main thread: about 1,000 write() messages and replies per frame and one placement measurement per visible terminal per frame.
Goal: every terminal at ≥ 60 updates/s (p10) with 1,000 live streaming terminals in one Chrome tab, headed at 120 Hz on the M5 Max.
Plan
- Profile the headed 1,000-terminal run (Chrome trace of main thread and workers) and record where the time goes.
- Fix what the profile shows. Candidates:
- batch pooled terminals' commands to a worker into one message per task (transferring the buffers), and batch replies back;
- stop measuring every terminal's layout every frame: cache placements and re-measure only on layout, scroll, resize, intersection or mutation changes;
- let a pooled terminal be fed inside its worker so streaming output never crosses the main thread, and add a worker-fed benchmark mode next to the main-thread driver;
- worker count, per-frame budgets, skipping unchanged terminals, atlas and upload costs.
- Measure and document.
Acceptance criteria
- Profile findings for the 1,000-terminal shared run (main thread and workers) recorded in the benchmark report.
- Headed 120 Hz benchmark, 3 rounds, at 256 / 512 / 1,000 / 1,500 / 2,000 shared terminals in both the main-thread driver mode and a worker-fed mode, reporting parsed, submitted and GPU-completed updates per terminal, p10, display rAF, long tasks, RSS, CPU and machine load average per run, with build hash and raw JSON.
- Before/after numbers for the main-thread driver mode at the same counts.
- The report states the highest count that holds p10 ≥ 60 in each mode. 60 fps at 1,000 is claimed only if the measured p10 ≥ 60, and only for the mode in which it was measured.
- Public API changes are additive and documented in README, packages/wraith/README and both ARCHITECTURE copies.
- Unit tests for batching and placement logic;
npm test,typecheck,build:demo,test:fleet,test:browser,test:xterm,test:worker-socketpass, so both the libghostty and xterm-compatible profiles still work.
Activity
0No activity yet.