Skip to content

perf(ui): keep wrapped large diffs responsive - #607

Open
mplibunao wants to merge 1 commit into
modem-dev:mainfrom
mplibunao:bugfix/wrapped-large-diff-main
Open

perf(ui): keep wrapped large diffs responsive#607
mplibunao wants to merge 1 commit into
modem-dev:mainfrom
mplibunao:bugfix/wrapped-large-diff-main

Conversation

@mplibunao

Copy link
Copy Markdown

Fixes #600

Summary

  • Enable exact file-level windowing for wrapped reviews instead of mounting every file section.
  • Highlight selected and visible files immediately, while deferring speculative neighbor/offscreen highlighting until navigation is idle.
  • Share wrapped-row width budgets between rendering and geometry, including note-guide and add-note columns.
  • Give no-hunk messages an explicit two-row body so window spacers and mounted content stay aligned.
  • Add component, geometry, render-window, and PTY regressions for wrapped navigation and rapid scrolling.

Why

Wrapping previously bypassed file-level windowing. On a large review this mounted the entire file stream and eagerly queued syntax highlighting on the main thread, producing a blank startup and high memory use. Exact precomputed section geometry now lets wrapped reviews mount only nearby files without changing scroll or hunk-navigation coordinates.

Validation

  • bun run lint
  • bun run format:check
  • bun run typecheck
  • bun run check:docs
  • bun run changeset:status
  • 96 focused unit/component tests
  • 15 targeted PTY tests, including wrapped cross-window hunk navigation and rapid scroll-to-edge recovery
  • 64/64 PTY integration tests with an isolated Git/TMP environment
  • Compiled binary build
  • Frozen 142-file wrapped review (20,853 insertions / 1,480 deletions, 216x60 Kitty), 5/5 valid runs:
    • first paint median 1.403s, max 1.505s
    • peak RSS max 348,618,752 bytes
    • prior affected baseline did not paint within 30s and reached 1,242,595,328 bytes
  • Literal local wrapper launch with the compiled candidate: paint, hunk navigation, and clean quit all passed

The broader macOS bun run test attempt reached 1,474 passing and 17 skipped tests; three pre-existing session E2E cases remained host-dependent because the harness assumes Linux script behavior and has daemon timing sensitivity. The changed surface and PTY integration suites pass, and upstream Linux CI remains authoritative for those session cases.

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

@mplibunao is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@mplibunao
mplibunao marked this pull request as ready for review July 27, 2026 08:32
@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@benvinegar benvinegar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this — the performance improvement looks promising, and the focused tests pass. I found two test gaps that I think should be addressed before merging:

  1. The navigation test can hide navigation bugs.

    pressUntilVisible repeatedly sends ] or [ until the last or first file appears. That means the test can still pass if a keypress is dropped, a navigation step is duplicated, or one press skips multiple hunks.

    After rebasing, could you use the ensureKeyboardIsLive helper now on main, then send the expected seven forward and seven backward keypresses explicitly? That would verify each navigation step rather than only checking that the test eventually reaches an edge.

  2. The highlight delay needs timer-focused coverage.

    The new behavior highlights visible files immediately and waits 300 ms before starting speculative highlighting. The current test only checks that an offscreen file is eventually highlighted, which the previous eager implementation would also pass.

    Could you add controlled-timer tests showing that:

    • selected and visible files start highlighting immediately;
    • speculative files wait for the idle threshold; and
    • scrolling or navigating cancels and restarts pending speculative work?

This branch also conflicts with current main in DiffPane.tsx, PierreDiffView.tsx, and the PTY harness. When resolving those conflicts, please preserve the newer custom file-view and current-line behavior, along with ensureKeyboardIsLive.

For validation, I ran the PR head separately: all 96 focused unit/component tests and all 15 navigation/scroll PTY tests passed. Typechecking stopped on the existing unrelated deep-instantiation error in src/core/customThemes.ts.

This comment was generated by Pi using gpt-5.6-sol

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.

Wrapped large diff remains blank on v0.17.6 while v0.13.2 renders

2 participants