The uphill climb of making diff lines performant
Apr 3, 2026Luke Ghenco, Adam Shwert11 min read
Pull Request Files Changed Performance#React Performance#Interaction to Next Paint (INP)#Virtualization
Opens github.blogWhat the post covers
This post details the engineering effort to optimize the 'Files changed' tab performance in pull requests, particularly for large ones.
- Key contributions include: reducing the number of React components per diff line from 8 to 2, simplifying the component tree, moving complex state (comments, context menus) to conditionally rendered child components, adopting O(1) data access using JavaScript Maps for state lookups, restricting useEffect usage to top-level components, and implementing window virtualization for rendering only visible portions of massive pull requests.
- These changes resulted in significant reductions in total lines of code, unique component types, components rendered, DOM nodes, memory usage, and INP scores.


