[diffs] Optimize diffs virtualized initial render#606
Conversation
Reduce large diff post-paint time by avoiding unnecessary synchronous layout reads, lazy-creating expensive shadow/style/sprite resources, tightening ResizeManager work, and reducing initial virtualized rendering work while keeping the safer 800px overscan for the active render window. Experiments: #4, #5, #9, #11, #12, #20, #23, #27, #31, #32, #33, #39, #42, #53, #54, #61, #62, #64, #65, #77, #81, #90, #91, #93, #104, #111, #113 Metric: post_paint_ready_ms 91.3ms → 24.6ms (-73.1%)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2fb624d98d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (metadataElement == null) { | ||
| if (this.heightCache.delete(lineIndex)) { | ||
| hasLineHeightChange = true; | ||
| } | ||
| measuredHeight += | ||
| line.nextElementSibling.getBoundingClientRect().height; | ||
| continue; |
There was a problem hiding this comment.
Measure non-metadata rows in wrap-mode height reconciliation
When overflow is wrap, rows can become taller from soft wrapping even without a sibling metadata row. This branch deletes cached heights and immediately continues whenever metadataElement is missing, so wrapped rows are never measured and computeApproximateSize() falls back to a single-line estimate. In large wrapped diffs this underestimates file height, which causes virtualized ranges/placeholders to drift and visible jumpiness while scrolling.
Useful? React with 👍 / 👎.
| 'ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible' | ||
| ); | ||
| } | ||
| if (disableAnnotations) { |
There was a problem hiding this comment.
Register code-column observers when annotations are enabled
The code-column observer setup is now guarded by if (disableAnnotations), so in the scroll+annotations path (disableAnnotations === false) no ObservedGridNodes are registered. As a result ResizeManager no longer updates --diffs-column-number-width / --diffs-column-content-width, and sticky annotation/merge-conflict content falls back to left: 0 and width: auto, which regresses horizontal-scroll alignment for annotated rows.
Useful? React with 👍 / 👎.
Reduce large diff post-paint time by avoiding unnecessary synchronous layout reads, lazy-creating expensive shadow/style/sprite resources, tightening ResizeManager work, and reducing initial virtualized rendering work while keeping the safer 800px overscan for the active render window.
Experiments: #4, #5, #9, #11, #12, #20, #23, #27, #31, #32, #33, #39, #42, #53, #54, #61, #62, #64, #65, #77, #81, #90, #91, #93, #104, #111, #113
Metric: post_paint_ready_ms 91.3ms → 24.6ms (-73.1%)