Skip to content

[diffs] Optimize diffs virtualized initial render#606

Open
SlexAxton wants to merge 1 commit intomainfrom
autoresearch/diffs-post-paint-ready/02-virtualized-initial-render
Open

[diffs] Optimize diffs virtualized initial render#606
SlexAxton wants to merge 1 commit intomainfrom
autoresearch/diffs-post-paint-ready/02-virtualized-initial-render

Conversation

@SlexAxton
Copy link
Copy Markdown
Contributor

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%)

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%)
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Apr 24, 2026 3:08am
pierrejs-docs Ready Ready Preview Apr 24, 2026 3:08am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +143 to +147
if (metadataElement == null) {
if (this.heightCache.delete(lineIndex)) {
hasLineHeightChange = true;
}
measuredHeight +=
line.nextElementSibling.getBoundingClientRect().height;
continue;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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