Skip to content

🤖 perf: let React Compiler compile ImmersiveReviewView - #4457

Merged
ThomasK33 merged 1 commit into
mainfrom
perf-compiler-immersive
Sep 24, 2026
Merged

ThomasK33 merged 1 commit into
mainfrom
perf-compiler-immersive

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

ImmersiveReviewView now compiles under React Compiler and leaves the guard's KNOWN_SKIPPED baseline (17/18 hot components compile). Iterating hunks in immersive review spends about 18% less script time.

Background

Follow-up to the React Compiler coverage stack (#4422, #4425–#4429) and #4439. The compiler skipped the whole component because of ??=, a try/catch/finally in the copy-file handler, three render-time ref writes, and one ref read during render.

Implementation

  • oldLineMap ??= … becomes oldLineMap = oldLineMap ?? ….
  • The copy-file handler's try/catch/finally uses runWithCatchFinally with the same body, error handler, and cleanup. Early returns keep their meaning because the try was the handler's last statement.
  • activeFilePathRef, activeFileContentVersionRef, and handleCopyFileRef are synced in useLayoutEffect instead of during render. Layout effects run in the commit's task, before passive effects, which is the ordering the existing comment requires for isStale().
  • selectedLineSummary (render path) read hunkJumpLineRangeRef through getCurrentLineSelection. A state mirror, hunkJumpLineRange, now feeds render. Every ref write also sets the state, next to the cursor/selection updates it batches with, and the hot-path callbacks keep reading the ref, so their identities stay stable. One visible difference: after a comment submit or composer cancel that clears the hunk-jump range while no line selection is active, the "Lines …" label now updates right away. Before, it kept showing the cleared range until the next render.

Validation

  • Guard: 17/18 hot components compile (1 known skipped); make static-check green.
  • src/browser/features/RightSidebar/CodeReview unit tests (79) and tests/ui/review (14) pass.

Measurements

Electron perf e2e, local, serial, 5 runs each, main at 334a5a6 vs this branch. ScriptDuration per run:

Scenario main (sorted runs) this PR (sorted runs) Median
Immersive hunk iteration, 1500 lines / 150 hunks 343, 351, 355, 356, 440 ms 270, 273, 290, 294, 299 ms 355 → 290 ms
Immersive mark-read, 1000 files 14, 16, 18, 19, 19 ms 14, 14, 20, 25, 26 ms 18 → 20 ms (noise)

Hunk-iteration wall time went from 448 to 376 ms (median). The regular review reopen scenario, which doesn't render this component, moved about 10% between runs, which is this host's noise level. The hunk-iteration ranges don't overlap.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $4.05

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T20:03:34.112200Z a54cc5b PR opened
🔒 Security Review ✅ Completed 2026-09-24T20:05:06.624474Z a54cc5b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThomasK33
ThomasK33 added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit d6420b1 Sep 24, 2026
30 of 31 checks passed
@ThomasK33
ThomasK33 deleted the perf-compiler-immersive branch September 24, 2026 20:22
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