Commit Graph

14 Commits

Author SHA1 Message Date
Mitchell Hashimoto
85b1dd0dd9 benchmark: formatter benchmark 2026-08-03 19:50:35 -07:00
Mitchell Hashimoto
0b5e12453b benchmark: add terminal-snapshot benchmark
Measures the terminal binary snapshot codecs in both directions
against the same terminal state. Setup feeds a pre-generated VT
stream (for example from ghostty-gen ascii) to a terminal outside
the timed region. 

Baseline measurements at this commit (M-series, ReleaseFast, 80x24,
unlimited scrollback, 1 MB corpora, per-loop time with setup
subtracted):

  ascii lines 1-70:  34.16 MB  encode  92.8 ms  decode 119.8 ms
  ascii full-wrap:   16.01 MB  encode  43.6 ms  decode  56.2 ms
  utf8:               4.33 MB  encode  12.4 ms  decode  19.0 ms
2026-08-02 12:36:18 -07:00
Mitchell Hashimoto
dc52c248e7 benchmark: terminal-resize 2026-07-31 20:00:34 -07:00
Mitchell Hashimoto
7e14347c13 terminal: bound page map probe lengths
#13292

Page maps previously allowed a 100% load factor. Once live entries
and tombstones filled every slot, a missing-key lookup or insertion
could scan the entire map.

Reserve 20% of each offset hash map as insertion headroom and track
that budget separately from the live count. Port the allocation-free
in-place rehash from Zig HashMapUnmanaged so canonical insertion can
rebuild fragmented probes and restore tombstone-exhausted headroom
without growing the page. Assumed-capacity insertion now applies the
same guard, preventing the headroom counter from wrapping.

Pass the exact requested hyperlink count into map layout before
load-factor scaling, avoiding a redundant power-of-two rounding step.
Screen-level recovery now grows only when live hyperlinks actually fill
usable capacity.

ReleaseFast terminal benchmarks compare main with the combined map
changes:

| workload | before | after | speedup |
|---|---:|---:|---:|
| map churn | 1.253 s | 12.5 ms | 100x |
| full OSC 8 stream | 3.576 s | 75.6 ms | 47x |
| clear and redraw | 299.1 ms | 118.3 ms | 2.5x |

Co-authored-by: Tim Culverhouse <tim@timculverhouse.com>
2026-07-11 09:21:27 -07:00
Mitchell Hashimoto
9156ada169 terminal: add cold-history compression pass
PageList could compress individual nodes but had no policy-level
operation for selecting pages that are safe to reclaim. The compressed
state therefore remained reachable only from tests.

Add a stateless pass that considers only complete history pages while
the viewport follows the active area. It gates work on supported
retained-mapping reclamation, reports attempts and retained bytes, and
leaves restoration lazy when a resize pulls compressed history back into
the active area.

Add a live scrollback-compression benchmark for measuring complete
PageList compression and restoration against saved VT corpora. The pass
still has no production callers, and ReleaseFast terminal-stream
comparisons remain within the existing throughput guardrail.
2026-07-09 09:47:12 -07:00
Mitchell Hashimoto
c62c159841 terminal: add standalone LZ4 block codec
Scrollback compression needs a codec that can be used from libghostty-vt
without pulling in libc, and we need to measure it before integrating it
with terminal page ownership.

This adds an allocation-free raw LZ4 block codec in scalar Zig.  Callers
provide the input, output, and fixed-size scratch table. The decoder
uses an exact-size output contract so page metadata mismatches fail
cleanly. Compatibility vectors, boundary cases, random round trips, and
fuzz coverage exercise the block format.

Also adds a page-compression benchmark that operates on reusable raw
page corpora. Compression and decompression have separate modes with
setup outside the timed region, plus a ratio report and no-op baseline.
Nothing uses compression in the terminal yet; this is the isolated codec
and measurement groundwork.
2026-07-09 09:47:11 -07:00
Mitchell Hashimoto
9a46397b59 benchmark: screen clone 2025-11-17 05:08:19 -10:00
Jeffrey C. Ollie
a7da96faee add two LUT-based implementations of isSymbol 2025-09-05 07:58:01 -05:00
Mitchell Hashimoto
a28b7e9205 synthetic cli (ghostty-gen) 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
99ed984af2 benchmark: add GraphemeBreak and TerminalParser benchmarks 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
5890826356 benchmark: add codepoint width benchmark 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
20bb71c627 libghostty: export benchmark CLI API 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
b8f5cf9d52 initial ghostty-bench program 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
0e8ccc7352 benchmark: a new package and framework for benchmarking 2025-07-09 15:06:23 -07:00