Skip to content

🤖 perf: WIP immersive review typing performance loop#2670

Draft
ammar-agent wants to merge 7 commits intomainfrom
review-render-6s54
Draft

🤖 perf: WIP immersive review typing performance loop#2670
ammar-agent wants to merge 7 commits intomainfrom
review-render-6s54

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Feb 26, 2026

Summary

WIP: iterative immersive-review typing performance work for very large diffs while preserving immersive layout stability.

Background

Profiling identified typing latency in inline review composer as primarily layout-bound on ~2,000-line immersive diffs.

Implementation

  • Replaced review-note autosize behavior that relied on scrollHeight reads with newline-count-based row syncing (2..8 rows), keeping the composer uncontrolled.
  • Reverted always-on offscreen row culling after it regressed immersive layout UX.
  • Reintroduced offscreen row culling in a narrower scope:
    • only while inline composer is active
    • only for very large rendered diffs (>= 500 lines)
    • excludes active/selected/composer-adjacent rows from culling
    • uses content-visibility + intrinsic-size hint on those offscreen rows

Validation

  • make static-check
  • make typecheck
  • bun test src/browser/components/shared/DiffRenderer.test.tsx
  • bun test src/browser/components/shared/SelectableDiffRenderer.dragSelect.test.tsx
  • Perf profiling (xvfb, dist-mode e2e local scenario, 2,000-line immersive typing):
    • pre-compose-culling baseline: immersive-large-diff-type-2000-post-fix-2026-02-26T16-57-44-801Z
    • latest: immersive-large-diff-type-2000-post-fix-4-2026-02-26T19-04-18-532Z

Latest Perf Delta (typing 300 chars, 2,000-line diff)

  • Wall time: 13,027ms -> 3,323ms (-74.5%)
  • TaskDuration: 13.15s -> 3.37s (-74.4%)
  • LayoutDuration: 9.25s -> 0.93s (-90.0%)
  • LayoutCount: unchanged (301), but each layout is much cheaper.

Risks

  • content-visibility behavior is browser-sensitive. Scope is intentionally narrow (composer-active + large diff only) to reduce UX blast radius.

WIP / Next Step

  • Continue profiling to identify the next bottleneck after the current layout-duration reduction.

Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $1.82

Switch the immersive review composer textarea to an uncontrolled input so each keypress no longer triggers React state updates across the diff surface.

Also move autosize work behind requestAnimationFrame scheduling to avoid synchronous per-key layout churn while keeping prefill + submit behavior unchanged.

---

_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.00`_

<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.00 -->
Reduce line-range selection lag in immersive review by coalescing drag selection updates to one per animation frame and avoiding redundant state writes when selection indices are unchanged.

This keeps hunk/cursor sync behavior intact while cutting expensive parent/child re-render churn during rapid mouse drag selection.

---

_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.00`_

<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.00 -->
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