---
title: "Crafting a better, faster code view"
description: "GitHub's new React-based code view renders an 18,000-line file in under a second instead of nearly 27 seconds."
url: "https://swe.quest/articles/crafting-a-better-faster-code-view-4c1560c4b1796bf2"
canonical: "https://github.blog/engineering/architecture-optimization/crafting-a-better-faster-code-view/"
source: "GitHub Engineering"
published: "2023-06-21"
difficulty: "medium"
kind: "Case study"
reading_minutes: 13
tags: ["web-performance","react","frontend","accessibility","browsers"]
---

# Crafting a better, faster code view

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2023-06-21, 13 min read, Case study. Original: [https://github.blog/engineering/architecture-optimization/crafting-a-better-faster-code-view/](https://github.blog/engineering/architecture-optimization/crafting-a-better-faster-code-view/)

## Summary

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.

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)
- [Accessibility](https://swe.quest/tags/accessibility.md) (Web & mobile)
- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)

## Prerequisites

- React rendering and reconciliation ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- DOM and CSS basics ([easy posts on CSS](https://swe.quest/tags/css.md?difficulty=easy))
- Core Web Vitals ([easy posts on Web performance](https://swe.quest/tags/web-performance.md?difficulty=easy))

## Keywords

GitHub, React, virtualization, Ctrl+F, Monaco, LCP, CODEOWNERS

## Related posts

- [Accessibility considerations behind code search and code view](https://swe.quest/articles/accessibility-considerations-behind-code-search-and-code-view-4501ed426b29574e.md): GitHub Engineering · 2023-07-06 · Medium · 10 min read · Accessibility, Frontend, Browsers, Design systems
  GitHub rebuilt code search and code view to remove accessibility barriers that pushed screen reader users toward raw files.
- [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.
- [The uphill climb of making diff lines performant](https://swe.quest/articles/the-uphill-climb-of-making-diff-lines-performant-3c1abf458c8d7ced.md): GitHub Engineering · 2026-04-03 · Medium · 10 min read · Web performance, React, Frontend, Performance engineering
  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.
- [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 pixels to characters: The engineering behind GitHub Copilot CLI’s animated ASCII banner](https://swe.quest/articles/from-pixels-to-characters-the-engineering-behind-github-copilot-cli-s-animated-179dc59ef1b7f7d4.md): GitHub Engineering · 2026-01-28 · Medium · 14 min read · Developer tools, Accessibility, TypeScript, React
  Animating a three-second ASCII banner for GitHub Copilot CLI took over 6,000 lines of TypeScript, mostly spent on terminal inconsistencies, accessibility and maintainable rendering rather than visuals.

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)
