perf(region): skip full repaint on idle/no-op redisplays - #119
Merged
Conversation
The active-region WFFULL escalation ran before the 'nothing to redisplay' early-out, so every update() cycle re-rendered the whole window while a region was active -- even no-op keys that moved nothing. Move it after the w_rflag==0 continue: only escalate a redraw that's already needed. Correctness is unchanged (a real move sets w_rflag, so the region still repaints and tracks point), and selecting-case bytes are identical (uline already diffs cells and emits only the changed boundary rows -- the region repaint was never sending the whole window). macOS 331/331, TSan clean, c-legacy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pj1ZHaD7aNhVWJ69SFKJcp
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.
While investigating region-highlight latency, confirmed mg's
ulinealready diffs at the cell level — so the active-region repaint was never sending the whole window; the extra bytes on a move are the inherent cost of the highlight shifting across ~2 boundary rows.The one real waste: the
WFFULLescalation ran before thew_rflag == 0early-out, so everyupdate()re-rendered all rows while a region was active, even for no-op keys. Moved it after the early-out — only escalate a redraw that is already needed. Correctness unchanged (a genuine move setsw_rflag, region still tracks point); selecting-case bytes identical (15 B plain / 153 B region, before and after).macOS 331/331 · TSan zero races · Alpine/musl 331/331 · legacy plain-C clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pj1ZHaD7aNhVWJ69SFKJcp