---
title: "The uphill climb of making diff lines performant"
description: "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."
url: "https://swe.quest/articles/the-uphill-climb-of-making-diff-lines-performant-3c1abf458c8d7ced"
canonical: "https://github.blog/engineering/architecture-optimization/the-uphill-climb-of-making-diff-lines-performant/"
source: "GitHub Engineering"
published: "2026-04-03"
difficulty: "medium"
kind: "Case study"
reading_minutes: 10
tags: ["web-performance","react","frontend","performance"]
---

# The uphill climb of making diff lines performant

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2026-04-03, 10 min read, Case study. Original: [https://github.blog/engineering/architecture-optimization/the-uphill-climb-of-making-diff-lines-performant/](https://github.blog/engineering/architecture-optimization/the-uphill-climb-of-making-diff-lines-performant/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Web performance](https://swe.quest/tags/web-performance.md) (Web & mobile)
- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- React components and hooks ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- DOM rendering basics
- Interaction to Next Paint (INP)

## Keywords

GitHub, TanStack Virtual, Interaction to Next Paint, useEffect, Datadog, pull requests

## Related posts

- [Rendering huge pull requests in the GitHub Copilot app](https://swe.quest/articles/rendering-huge-pull-requests-in-the-github-copilot-app-dfdd1afcfdc347d9.md): GitHub Engineering · 2026-09-23 · Medium · 13 min read · Frontend, Web performance, Performance engineering, Testing, Observability
  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.
- [Crafting a better, faster code view](https://swe.quest/articles/crafting-a-better-faster-code-view-4c1560c4b1796bf2.md): GitHub Engineering · 2023-06-21 · Medium · 13 min read · Web performance, React, Frontend, Accessibility, Browsers
  GitHub's new React-based code view renders an 18,000-line file in under a second instead of nearly 27 seconds.
- [How GitHub Actions renders large-scale logs](https://swe.quest/articles/how-github-actions-renders-large-scale-logs-b2578d67d9b7f62e.md): GitHub Engineering · 2021-03-25 · Medium · 6 min read · Frontend, Web performance, JavaScript, Browsers
  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.
- [From latency to instant: Modernizing GitHub Issues navigation performance](https://swe.quest/articles/from-latency-to-instant-modernizing-github-issues-navigation-performance-d76fe4f2daa6064a.md): GitHub Engineering · 2026-05-14 · Medium · 13 min read · Web performance, Caching, Frontend, Local-first & sync, Browsers
  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.
- [Improving site performance by shipping more CSS](https://swe.quest/articles/improving-site-performance-by-shipping-more-css-41480dcc45d65149.md): GitHub Engineering · 2026-09-25 · Medium · 7 min read · CSS, Web performance, Refactoring & migrations, Design systems, React
  GitHub migrated its Primer Design System and the github.com codebase from styled-components CSS-in-JS to CSS Modules, removing runtime styling costs on client and server.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
