
The uphill climb of making diff lines performant
4/3/2026
This post details the engineering effort to improve the performance of the 'Files changed' tab in pull requests, particularly for large ones. It outlines the v1 architecture's performance bottlenecks (high DOM node counts, excessive React components and event handlers, large JS heap usage) and the subsequent v2 refactor. Key improvements include simplifying the component tree (from 8+ components per line to 2), moving complex state (like comments) to conditionally rendered children, adopting O(1) data access using JavaScript Maps, and restricting useEffect usage. The post also introduces window virtualization as a strategy for extremely large pull requests. Metrics show significant reductions in component types, rendered components, memory usage, and INP.