GitHub Copilot app: virtualizing million-line diffs with comments

GitHub's Copilot app PR view keeps exact code row heights and measures review comments in one batched pass near the viewport, never mid-scroll.

Card on GitHub Copilot app's rebuilt PR view: a 2,000+ file, 1M line test PR and what shipped.

Virtualizing a million-line diff is the solved part. The review comments are what break it.

GitHub rebuilt its Copilot app PR view and tested it on an open source PR with over 2,000 files, a million changed lines and 400 inline comments.

Code rows are arithmetic. Known line heights, offsets computed up front, about 100 rows in the DOM.

A comment's height is unknown until it renders: wrapped markdown, an open details block, a reply box, a late image.

First design: a ResizeObserver per block, writing heights back. It retriggered itself.

What shipped:

  • Two geometries: exact code rows, separately measured comment blocks
  • One batched measure pass near the viewport, never mid-scroll
  • Observers flag a block for the next pass
  • Scroll fixes anchored to the row you're reading

One bug hid in their "is the user scrolling?" guard. The app's own scrolls tripped it too.

Trust the heights you know. Measure the rest in one place.

Watch the video on LinkedIn ↗