Skip to content

perf(workstation): debounce + cache commit detail hydration#1533

Merged
gfargo merged 1 commit into
mainfrom
perf/commit-detail-debounce-cache
Jul 7, 2026
Merged

perf(workstation): debounce + cache commit detail hydration#1533
gfargo merged 1 commit into
mainfrom
perf/commit-detail-debounce-cache

Conversation

@gfargo

@gfargo gfargo commented Jul 7, 2026

Copy link
Copy Markdown
Owner

The "biggest felt win" from the keystroke-latency audit (#1365, item 2).

Previously every j/k cursor move immediately spawned getCommitDetail (4 git subprocesses). Now:

  • 120ms debounce — rapid j/k resets the timer, no fetch fires mid-scroll
  • 100-entry hash-keyed cache — previously-viewed commits render instantly with no loading flash
  • FIFO eviction — memory stays bounded

Tests updated to use jest fake timers for the debounce behavior.

Testing:

  • tsc --noEmit clean
  • useCommitDetailHydration tests (4 tests) pass

Relates to #1365

Add 120ms debounce and a 100-entry hash-keyed cache to
useCommitDetailHydration. Previously every j/k cursor move immediately
spawned getCommitDetail (4 git subprocesses). Now:

- Rapid navigation resets the timer (no fetch fires mid-scroll)
- Previously-viewed commits render instantly from cache with no
  loading flash
- FIFO eviction keeps memory bounded

This is the 'biggest felt win' from the keystroke-latency audit
(#1365 item 2).

Tests updated to use jest fake timers for the debounce.
@gfargo gfargo merged commit d69dcda into main Jul 7, 2026
11 of 12 checks passed
@gfargo gfargo deleted the perf/commit-detail-debounce-cache branch July 7, 2026 17:20
gfargo pushed a commit that referenced this pull request Jul 12, 2026
)

Adds the same 120ms debounce + bounded (hash, path, oldPath)-keyed
cache pattern already shipped for useCommitDetailHydration (#1533) to
useCommitFilePreviewHydration, so holding j/k in a commit's file list
no longer fires an uncached git show subprocess per cursor move and
previously-visited previews redisplay instantly.

Co-authored-by: gfargo-horizon-agent[bot] <294710345+gfargo-horizon-agent[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant