Replace the --with-scrollback and --render flags with two new
benchmarks, scrollback and render, that use the ASCII text with the
main screen and with rendering allowed, respectively. All other
benchmarks use the alternate screen with rendering suppressed. Add an
--output flag to also write the results to a file as JSON and list the
available benchmarks with descriptions in the help text.
The two benchmarks now use text with the same structure: the same lines,
of the same widths in cells, ending in CRLF and with tabs at the same
positions, differing only in the characters used to fill them. Before,
the ASCII text had a bare newline about every 90 bytes, while the
Unicode text was long lines of mostly CJK text, so they were dominated
by different costs. Also report the rate at which cells are drawn for
them, since non-ASCII characters are encoded in more bytes.
Add truecolor_text, where every char has a random 24-bit foreground,
palette16_text, the same but with only 16 distinct colors, and
halfblocks, rows of half blocks with random 24-bit foreground and
background as written by terminal image viewers.
The existing benchmarks use either no colors or a handful of fixed
SGR codes, which favors terminals that store styles in a per page
deduplicated table rather than in each cell. These benchmarks measure
the cost of output with many distinct styles, which is common in
practice.
Add a benchmark stream containing 262,144 distinct base-plus-combining-mark cells per repetition so TextCache collection cost remains visible instead of collapsing into cache hits.
Co-Authored-By: Claude <noreply@anthropic.com>
On macOS reading from the same tty device file as we are writing too in
another thread gives continuous EAGAIN errors. We dont actually need
simultaneous read/write, so move the reads to the end.