Commit Graph

1 Commits

Author SHA1 Message Date
alan f7ef4d1445 Terminal emulator: faster write path (ASCII runs, reused lines, no per-char allocation)
- Parser reads the written strings directly (no rune list per write) and
  handles printable ASCII runs and C0 controls straight from the string;
  a run is written into the line in one call (Buffer.writeAscii,
  BufferLine.setAsciiCells), as writeChar would one by one.
- A line leaving a full scrollback (or a one-line region scroll) is
  cleared and reused instead of allocating a 4 KiB line; lines with
  anchors (selection ends) still leave detached. Lines track the cells
  written since made or cleared, so a clear touches only those.
- Grapheme join rejects characters that cannot join before reading the
  cell (it built a String per character); width table covers plane 1.
- Switch dispatch for C0 controls, direct calls for CSI and SGR (torn-off
  handlers are slow in JavaScript); CSI params emptied without clear();
  circular buffer index without %; insert keeps the start index wrapped.
- Terminal.write(notify: false) lets a host notify once per frame.
- tool/perf/terminal_parse_bench.dart: parse throughput in the VM or V8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 02:34:08 +00:00