Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

GitHub Engineering 13 min read Case study mediumAdept

Rendering huge pull requests in the GitHub Copilot app

The GitHub Copilot app's pull request view stays responsive on a 2,200-file, million-line diff with 400+ review comments by splitting document height into two geometries: exact, precomputed prefix-summed code rows and lazily measured dynamic blocks for comments, drafts and composers. A single idle- and scroll-gated measurement pass scoped to about 2400px around the viewport replaces per-block ResizeObserver write-back, which caused feedback loops. Observers only flag blocks for re-measurement, except for user-caused resizes, which commit synchronously at most once per frame. Identity-based scroll anchoring keeps corrections small, and a cache of recent diffs prevents an instantly drawn shell from sitting around an empty diff. Bugs were found with permanent in-app probes asserted as CI budgets and an autonomous headless change→measure→improve loop.

Assumes: DOM list virtualizationbrowser layout and reflowResizeObserverReact rendering

Related posts

  • Crafting a better, faster code view

    GitHub Engineering mediumAdept

    GitHub's new React-based code view renders an 18,000-line file in under a second instead of nearly 27 seconds. Lines outside the viewport are virtualized away, while an invisible textarea holds the full raw text so native Ctrl+F, keyboard navigation and screen readers keep working. A custom find-in-file was dropped after beta users and assistive-technology needs favoured the browser's native find. The visible syntax-highlighted overlay is hidden from find by injecting each character through CSS :before pseudoelements. Switching the highlighter to emit offset/class ranges and building HTML strings outside React cut a jump-to-end scroll from about 4.5s to about 0.8s of main-thread work.

  • The uphill climb of making diff lines performant

    GitHub Engineering mediumAdept

    GitHub rebuilt the React diff-line components in the pull request Files changed tab after large PRs pushed the JavaScript heap past 1 GB, DOM counts above 400,000 and INP to unusable levels. The v2 design cut per-line React components from eight to two, replaced per-line event handlers with a single top-level handler keyed on data attributes, and moved commenting and menu state into conditionally rendered children. It also confined useEffect to the file level and switched to O(1) Map-based lookups. On a 10,000-line split diff this cut rendered components by 74%, memory by about 50% and INP from ~450 ms to ~100 ms. For p95+ PRs, TanStack Virtual windowing gave a 10x heap and DOM reduction and 40–80 ms INP, supplemented by cheaper CSS selectors, GPU transforms, partial hydration and progressive diff loading.

  • How GitHub Actions renders large-scale logs

    GitHub Engineering mediumAdept

    GitHub Actions replaced a third-party virtualization library with a custom one to render job logs of up to 50k lines smoothly, including on mobile. Usage data showed 99.51% of jobs have fewer than 50k lines, so the team dropped data virtualization and kept only UI virtualization, truncating oversized logs behind a download link. The custom library estimates line heights instead of measuring them and uses relative rather than absolute positioning, so imprecise estimates don't clip lines. It keeps a single scrollable area with non-virtualized sticky step headers and adds or removes DOM nodes in clusters of 50 lines to limit mutations during fast scrolling.

  • From latency to instant: Modernizing GitHub Issues navigation performance

    GitHub Engineering mediumAdept

    GitHub made Issues navigation feel instant by moving to a local-first, stale-while-revalidate model: render issue pages from client-side data first, then revalidate in the background. A persistent IndexedDB cache made about 22% of React soft navigations instant at a ~33% hit rate, with roughly 4.7% server/cache divergence. Rate-limited, low-priority preheating from issue lists and an in-memory cache tier raised the hit ratio to ~96%, so up to ~70% of React navigations became instant. A service worker extends the cache to Turbo and hard navigations by signalling cache hits via a request header, letting the server return a thin HTML shell instead of a full server-rendered page. The tradeoff on hard navigations is that the critical path shifts to JavaScript download and execution.

  • Rendering Engine Tales: Road to Concurrent React

    Zalando Engineering mediumAdept

    Zalando migrated its Rendering Engine framework, which renders the Fashion Store from backend-defined Entity trees mapped to React Renderers, to React 18 concurrent rendering. Each Renderer is wrapped in a Suspense boundary. Data resolution, ordering and transitions live in a central Application State layer outside React, and a Connector hook suspends components until their data is written. This mixed design was chosen because SuspenseList is still experimental, useTransition ignores nested Suspense boundaries, and Render-As-You-Fetch hooks couple fetch timing to render order. Switching to renderToPipeableStream and hydrateRoot alone, rolled out via A/B test, cut INP by 5.69%, FID by 8.81% and LCP by 2.43%. It also exposed many hydration mismatch errors, and the post covers fixes for common causes such as timers, time-zone-dependent date localization and client-only content.

The quest for software engineering knowledge.

Look:
Layout: