Repository navigation
renderer, termio: count each surface's thread wakes by source - #73
Merged
lawrencecchen merged 2 commits intoNov 3, 2026
Merged
Conversation
ghostty_surface_render_counters gains seven fields at its end: the renderer thread's wakeup async, draw-now async, cursor blink, animation and scrollback-compression timer fires, and the termio thread's wakeup async and timer fires. Why: cmux keeps hidden terminals live (its warm set). A live hidden surface costs about 2.4-3.4 process wakeups a second while idle and 3-4 more per output batch, on threads cmux's own counters do not see. These counts tell which source it is, per surface, so a test can bound them exactly.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Contributor
Author
|
Review (subagent, correctness first): SHIP at 9509f26
|
…claration between container fields)
Contributor
Author
|
Review (subagent, correctness first): SHIP at 782f66b
|
lawrencecchen
added a commit
that referenced
this pull request
Nov 4, 2026
The release line moved after the first merge. Keep its head an ancestor of main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ghostty_surface_render_countersgains seven fields at the end of the struct. They count each surface's thread wakes by source:Each count is one relaxed atomic add in a callback that already runs. No behavior changes.
Why
cmux keeps hidden terminals live (its warm set). On cmux24, 24 busy hidden terminals at a warm cap of 25 woke the app 181.8 times a second, against 76.9 at a cap of 8. None of those wakeups were on the main thread.
cmux's own counters show that its output path already runs once per hidden output batch. So the remaining cost, about 2.4-3.4 wakeups a second while idle plus 3-4 per batch for each live hidden terminal, is on the surface's own threads. These counts name the source, per surface, so a cmux test can bound it exactly (cmux SWITCH FRAMES, "hidden output" row).
Base
This is based on
release/cmux-9ce9b7d0-e2(34e73ba8b), the cmux pin, so that one GhosttyNextKit pin bump takes only this change. The struct grows at its end; the existing fields keep their offsets.Test plan
fix/hidden-terminal-wakeups) reads these counts for live hidden surfaces.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Adds per-surface thread wake counters to
ghostty_surface_render_countersso a cmux test can bound the cost of keeping hidden terminals alive. Each counter is a relaxed atomic add in an existing callback; no behavior changes.Written for commit 782f66b. Summary will update on new commits.