Stress-test ASCII video at 30/60/120 fps; fix libghostty-vt Debug build
Added a full ASCII-video benchmark suite that hammers the renderer with 30 KiB / 70 KiB full-screen frames at 30, 60, and 120 fps targets — both renderer-only and full-pipeline (em.Write + renderer + stdout). Each stream benchmark reports µs/frame, fps_ceiling, and percent of the per-frame budget consumed. The pipeline benchmarks revealed we were missing 120 fps by a wide margin (190%-350% of budget at 120fps, 60-90 fps ceiling). Isolating em.Write confirmed libghostty-vt is the bottleneck — 16-29 ms per truecolor frame, library file at 33 MiB. Root cause: the Makefile invoked `zig build` with no -Doptimize, and Zig's standardOptimizeOption defaults to Debug. So the shipped libghostty-vt was unoptimised. Fixed by pinning ReleaseFast in the Makefile (override via GHOSTTY_VT_OPTIMIZE for debug builds of the upstream lib). Existing checkouts need `make clean-deps && make deps` to pick up the rebuild.
This commit is contained in:
15
Makefile
15
Makefile
@@ -20,10 +20,21 @@ $(SOURCE)/.git/HEAD:
|
||||
|
||||
deps-fetch: $(SOURCE)/.git/HEAD
|
||||
|
||||
# Zig's `standardOptimizeOption` defaults to .Debug when no
|
||||
# -Doptimize is passed, which makes libghostty-vt's CSI/SGR parser
|
||||
# an order of magnitude slower — truecolor full-screen frames spend
|
||||
# ~16-29 ms each in em.Write under Debug (see
|
||||
# internal/app/bench_test.go BenchmarkEmulator_Write_*), which caps
|
||||
# the full PTY-to-host pipeline at ~60 fps. ReleaseFast is the
|
||||
# right default for the shipped artefact. Override with
|
||||
# `make deps GHOSTTY_VT_OPTIMIZE=Debug` when you actually want a
|
||||
# debug build of the upstream lib.
|
||||
GHOSTTY_VT_OPTIMIZE ?= ReleaseFast
|
||||
|
||||
$(INSTALL)/lib/libghostty-vt.a: $(SOURCE)/.git/HEAD
|
||||
@command -v zig >/dev/null || { echo "ERROR: zig not on PATH (need >=0.15.2 to build libghostty-vt)"; exit 1; }
|
||||
@echo ">> building libghostty-vt with zig"
|
||||
@cd $(SOURCE) && zig build -Demit-lib-vt --prefix $(INSTALL)
|
||||
@echo ">> building libghostty-vt with zig (optimize=$(GHOSTTY_VT_OPTIMIZE))"
|
||||
@cd $(SOURCE) && zig build -Demit-lib-vt -Doptimize=$(GHOSTTY_VT_OPTIMIZE) --prefix $(INSTALL)
|
||||
@test -f $(INSTALL)/lib/libghostty-vt.a || { echo "ERROR: expected static lib at $(INSTALL)/lib/libghostty-vt.a"; exit 1; }
|
||||
@echo ">> libghostty-vt installed under $(INSTALL)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user