Files
ghostty/src
Mitchell Hashimoto 9e3019f190 terminal/snapshot: variable-width grid cell encoding
Add a per-row encoded cell width to the PAGE grid format. Rows
previously always spent eight bytes per cell, but a plain text cell
carries only a codepoint: on line-shaped scrollback most encoded
bytes were predictable zeros that still had to pass through CRC32C,
BLAKE3, both codecs, and any transport compression the caller
applies.

Each row now declares one of four widths in previously reserved row
flag bits, chosen canonically as the smallest width admitted by the
bitwise OR of the row cell words: one or two bytes transport a bare
codepoint, four bytes transport the low word half (any content kind,
style IDs up to sixty-three, no wide or flag or hyperlink bits), and
eight bytes remain the full word. Every width is a truncation on
encode and a zero-extension on decode, so narrow rows encode and
decode as vectorizable integer loops, one and two byte rows need at
most surrogate replacement and skip cell normalization entirely, and
full-width rows keep the existing bulk copy. Decoders use the
declared width for framing and accept rows encoded wider than
necessary. Rows containing wide characters, hyperlinks, semantic
content, or large style IDs still use the full width, which leaves
CJK-heavy content unchanged.

Benchmark deltas at this commit (terminal-snapshot, M-series,
ReleaseFast, 1 MB corpora):

  ascii lines 1-70:  7.66 MB -> 1.03 MB (7.4x)
                     encode 5.8 -> 2.0 ms, decode 8.1 -> 2.7 ms
  ascii full-wrap:   8.04 MB -> 1.04 MB (7.7x)
                     encode 5.4 -> 1.3 ms, decode 7.2 -> 1.8 ms
  utf8:              unchanged (wide cells keep rows at full width)

For a caller compressing the stream, the lines snapshot end to end
with zstd -1: encode plus compress 18.5 -> 2.8 ms, decompress plus
decode 15.8 -> 3.6 ms, and the compressed size itself drops from
1.35 MB to 0.86 MB because the packed stream is denser for the
entropy coder.
2026-08-02 14:32:48 -07:00
..
2026-07-21 12:35:05 -07:00
2026-03-15 20:58:43 -04:00
2026-07-21 12:35:05 -07:00
2026-07-30 08:51:38 -07:00
2026-07-21 17:19:16 -07:00
2025-10-03 18:52:26 +02:00
2026-07-21 12:35:05 -07:00
2026-07-21 17:19:16 -07:00
2026-07-21 12:35:05 -07:00
2025-11-27 13:37:53 -08:00
2025-11-27 13:37:53 -08:00
2026-07-21 12:35:05 -07:00
2026-07-26 15:38:19 -07:00
2026-07-21 17:19:16 -07:00
2026-07-21 12:35:05 -07:00
2026-07-21 17:19:16 -07:00
2026-07-21 17:19:16 -07:00
2024-08-16 14:35:10 -07:00
2026-07-21 17:19:16 -07:00
2022-08-18 11:42:32 -07:00
2026-03-20 10:37:42 -05:00
2026-07-21 12:35:05 -07:00
2026-07-28 11:04:13 -05:00
2026-07-21 12:35:05 -07:00