Attach: compress snapshot frames and cap history at the client scrollback (S10) #2

Open
opened 2026-10-02 00:16:04 +00:00 by jhgaylor · 0 comments
Owner

S10 measured a 64k-row attach on a throttled phone going from ~3.7 s to ~0.35 s with these two changes. Re-measure with real terminal output.

From PLAN.md, section "Protocol → Attach and resume".


  • Visible-first attach is gated on measurement (decided 2026-10-01). Measured in S10: don't build it for xterm.js.
    • Where the time goes: on an emulated Pixel 7 at 4x CPU throttling and 10 Mbps / 50 ms, attaching to a 64k-row pane took 3.7 s, of which 3.2 s was download. The snapshot goes out uncompressed (3.9 MB; 183 KB gzipped). The client keeps only 10k lines, so 54k of the 64k rows are downloaded and thrown away. Even a small screen takes about 150 ms to draw at 4x, which is the most visible-first could save. See spikes/s10-ghostty-web.

    • Do instead (small, server-side, fix now):

      • compress snapshot frames (permessage-deflate, or zstd frames);
      • cap the history in a snapshot at the client's scrollback (sent in attach).

      Together they took the 64k case on the throttled phone from about 3.7 s to about 0.35 s. Real terminal output compresses worse than S10's synthetic lines, so re-measure.

    • M8 gives visible-first natively later, through GHOSTSNP's screen-then-history split. The design below is kept only for reference.

S10 measured a 64k-row attach on a throttled phone going from ~3.7 s to ~0.35 s with these two changes. Re-measure with real terminal output. _From PLAN.md, section "Protocol → Attach and resume"._ --- - **Visible-first attach is gated on measurement (decided 2026-10-01). Measured in S10: don't build it for xterm.js.** - **Where the time goes:** on an emulated Pixel 7 at 4x CPU throttling and 10 Mbps / 50 ms, attaching to a 64k-row pane took 3.7 s, of which 3.2 s was download. The snapshot goes out uncompressed (3.9 MB; 183 KB gzipped). The client keeps only 10k lines, so 54k of the 64k rows are downloaded and thrown away. Even a small screen takes about 150 ms to draw at 4x, which is the most visible-first could save. See [spikes/s10-ghostty-web](https://git.inevitable.fyi/jhgaylor/illogical/src/branch/main/spikes/s10-ghostty-web/README.md). - **Do instead (small, server-side, fix now):** - **compress snapshot frames** (permessage-deflate, or zstd frames); - **cap the history in a snapshot at the client's scrollback** (sent in `attach`). Together they took the 64k case on the throttled phone from about 3.7 s to about 0.35 s. Real terminal output compresses worse than S10's synthetic lines, so re-measure. - M8 gives visible-first natively later, through GHOSTSNP's screen-then-history split. The design below is kept only for reference.
Sign in to join this conversation.
No description provided.