Skip to content

fix: typing no longer stalls on the staged-changes gutter (#115) - #117

Merged
antonarnaudov merged 1 commit into
mainfrom
fix/typing-diff-stall
Oct 14, 2026
Merged

antonarnaudov merged 1 commit into
mainfrom
fix/typing-diff-stall

Conversation

@antonarnaudov

Copy link
Copy Markdown
Contributor

Fixes #115.

The staging gutter re-diffed the buffer against HEAD and the index after each typing pause, synchronously on the extension host. Under 1,700 lines vscode-diff uses its DP table and checks its timeout (one Date.now()) per cell: ~640k clock reads for one edit in an 800-line file. With a syscall clocksource (hpet, ~1.2 µs/read) that is ~820 ms per pause — matching the report (mean 758 ms, max 823 ms).

  • engine/lineDiff.ts: DateTimeout.isValid shares one clock read per 256 checks; once expired it stays expired. Same results; covers the gutter, webview tick model, desktop and merge editor. 800-line edit at 1.2 µs/read: 643,765 reads / 823 ms → 2,516 / 14 ms.
  • stagedGutter.ts: a typing-only refresh re-diffs against the last-read HEAD/index text (no git show ×2 / git status per pause); focus, save, ref/index moves, settings and toggle still read git. In-flight refreshes coalesce; unchanged document versions skip. listChangeBlocks split into readBaselines + changeBlocksFrom.
  • Untracked-file blame: git cat-file -e HEAD:<path> on failure → BlameNotCommittedError; not logged, and not retried until a repo change (commit / add).

Tests (each fails on the old code): engine diffClock, stagedGutterState (typing spawns no git), blameController.surface (untracked file blamed once, retried after commit), git-service indexWrites. engine 546, git-service 1408, webview-ui 573, merge-vscode 391, extension 1986, desktop 2014; verify --fast OK.

🤖 Generated with Claude Code

…he gutter (#115)

The staging gutter re-diffs the open file against HEAD and the index on every
pause in typing. vscode-diff checks its 5 s time budget with Date.now() once
per cell of its n×m table for texts under 1,700 lines together: 643,765 clock
reads for one keystroke in an 800-line file. Where reading the clock is a
system call (Linux on the hpet clocksource, ~1.2 µs) that is ~820 ms blocked
per refresh; measured with a 1.2 µs clock: 823 ms before, 14 ms after.

- lineDiff: 256 of vscode-diff's budget checks share one clock read (2,516
  reads for the same edit). A spent budget stays spent; same results.
- StagedGutter: an edit re-diffs the buffer against the HEAD/index text and
  conflict state git gave last time, instead of `git status` + two `git show`s
  per pause. Focus, save, ref/index moves and toggles still read git. A refresh
  waits for the running one for the same document, and an unchanged version
  is not re-diffed.
- Blame: an untracked file is no longer blamed (and logged as a failure) on
  every edit. BlameProvider asks git whether the path is in HEAD
  (cat-file -e, not the translated message) and throws BlameNotCommittedError;
  the controller stops asking until git reports a repository change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@antonarnaudov
antonarnaudov merged commit 29a66e8 into main Oct 14, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typing stalls: full diff recomputed synchronously on the extension-host main thread per edit

1 participant