fix(perf): stop UI-thread subprocess forks and fixed 60fps repaint - #42
Merged
Conversation
Session autosave only stamped its "last saved" timestamp on a successful write, so once the fingerprint stabilized the interval check passed on every frame and capture_session() forked `ps` per pane at 60Hz — the direct cause of "app not responding" freezes. Title/cwd/git/PR probes (ps, lsof, git, gh) now run on a dedicated worker thread instead of the UI thread, batched and memoized so a handful of panes don't fork a process per pane per second. Also cuts key->screen latency for typing and nvim navigation: the app no longer pins request_repaint_after(16ms) unconditionally (now paced by the cursor blink instead of animating a static screen at 60Hz), Fonts::has_glyph lookups for box-drawing/Nerd Font glyphs are memoized instead of re-walking the font fallback chain every cell every frame, and the per-frame grid snapshot reuses its buffer instead of reallocating every pane's cell grid each frame. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
nakulbh
force-pushed
the
fix/ui-thread-latency
branch
from
July 29, 2026 14:59
3b48fed to
4e76555
Compare
Public rustdoc must not link private cwd_of_process; RUSTDOCFLAGS=-Dwarnings failed the Linux Doc CI step.
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
save_session_nowonly stamped its "last saved" timestamp after a successful write, so once the session fingerprint stabilized (the normal steady state — nothing about the layout changes while you type) the autosave interval check passed on every frame, andcapture_session()walks every pane and forkedpsper pane at 60Hz on the UI thread.ps,lsof//proc,git rev-parse,gh pr view) off the UI thread onto a dedicated worker (rmux-title-probe), batched into onepssnapshot per cycle with per-directory memoization and automatic back-off whenghis slow (e.g. flaky network/DNS).j/knavigation:request_repaint_after(16ms)was unconditional, pinning the app at 60fps even on a fully static screen — now paced by the cursor blink interval instead.Fonts::has_glyphwas called per non-ASCII cell per frame (box-drawing borders in agent prompt boxes, Nerd Font icons in nvim's file tree) — now memoized in the glyph cache.Vec<Vec<GridCell>>from scratch every pane every frame — now reuses a buffer viaTermState::snapshot_into.Test plan
cargo clippy --workspace --all-targets— cleancargo test --workspace— all passing (380+ tests, including new coverage for the probe worker and snapshot buffer reuse)claude --resume,grok) still fire correctly🤖 Generated with Claude Code