{"id":72597,"date":"2023-06-21T10:35:17","date_gmt":"2023-06-21T17:35:17","guid":{"rendered":"https:\/\/github.blog\/?p=72597"},"modified":"2023-06-21T10:35:17","modified_gmt":"2023-06-21T17:35:17","slug":"crafting-a-better-faster-code-view","status":"publish","type":"post","link":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/","title":{"rendered":"Crafting a better, faster code view"},"content":{"rendered":"<p>Reading code is not as simple as reading the text of a file end-to-end. It is a non-linear, sometimes chaotic process of jumping between files to follow a trail, building a mental picture of how code relates to its surrounding context. GitHub\u2019s mission is to be the home for all developers, and reading code is one of the core experiences we offer. Every day, millions of users use GitHub to view and interact with code. So, about a year ago we set out to create a new code view that supports the entire code reading experience with features like a file tree, symbol navigation, code search integration, sticky lines, and code section folding. The new code view is powerful, intelligent, and interactive, but it is not an attempt to turn the repository browsing experience into an IDE.<\/p>\n<p>While building the new code view, our team had a few guiding principles on which we refused to compromise:<\/p>\n<ul>\n<li>It must add these powerful new features to transform how users read code on GitHub.<\/li>\n<li>It must be intuitive and easy to use for all of GitHub\u2019s millions of users.<\/li>\n<li>It must be fast.<\/li>\n<\/ul>\n<h2 id=\"initial-efforts\"><a class=\"heading-link\" href=\"#initial-efforts\">Initial efforts<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>The first step was to build out the features we wanted in a natural, straightforward way, taking the advice that &#8220;premature optimization is the root of all evil.&#8221;<sup id=\"fnref-72597-1\"><a href=\"#fn-72597-1\" class=\"jetpack-footnote\" title=\"Read footnote.\">1<\/a><\/sup> After all, if simple code satisfactorily solves our problems, then we should stop there. We knew we wanted to build a highly interactive and stateful code viewing experience, so we decided to use React to enable us to iterate more quickly on the user interface. Our initial implementation for the code blob was dead-simple: our syntax highlighting service converted the raw file contents to a list of HTML strings corresponding to the lines of the file, and each of these lines was added to the document.<\/p>\n<p>There was one key problem: our performance scaled badly with the number of lines in the file. In particular, our <a href=\"https:\/\/developer.chrome.com\/docs\/lighthouse\/performance\/lighthouse-largest-contentful-paint\/\">LCP<\/a> and <a href=\"https:\/\/developer.chrome.com\/en\/docs\/lighthouse\/performance\/interactive\/\">TTI<\/a> times measurably increased at around 500 lines, and this increase became noticeable at around 2,000 lines. Around those same thresholds, interactions like highlighting a line or collapsing a code section became similarly sluggish. We take these performance metrics seriously for a number of reasons. Most importantly, they are user-centric\u2014that is, they are meant to measure aspects of the quality of a user\u2019s experience on the page. On top of that, they are also part of how search engines like Google determine where to rank pages in their search results; fast pages get shown first, and the code view is one of the many ways GitHub\u2019s users can show their work to the world.<\/p>\n<p>As we dug in, we discovered that there were a few things at play:<\/p>\n<ul>\n<li>When there are many DOM nodes on the page, style calculations and paints take longer.<\/li>\n<li>When there are many DOM nodes on the page, DOM queries take longer, and the results can have a significant memory footprint.<\/li>\n<li>When there are many React nodes on the page, renders and DOM reconciliation both take longer.<\/li>\n<\/ul>\n<p>It&#8217;s worth noting that none of these are problems with React specifically; any page with a very large DOM would experience the first two problems, and any solution where a large DOM is created and managed by JavaScript would experience the third.<\/p>\n<p>We mitigated these problems considerably by ensuring that we were not running these expensive operations more than necessary. Typical React optimization techniques like memoization and debouncing user input, as well as some less common solutions like pulling in an <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/standard\/events\/observer-design-pattern\">observer pattern<\/a> went a long way toward ensuring that React state updates, and therefore DOM updates, only occurred as needed.<\/p>\n<p>Mitigating the problem, however, is not solving the problem. Even with all of these optimizations in place, the initial render of the page remained a fundamentally expensive operation for large files. In the repository that builds GitHub.com, for example, we have a CODEOWNERS file that is about 18,000 lines long, and pushes the 2MB size limit for displaying files in the UI. With no optimizations besides the ones described above, React\u2019s first pass at building the DOM for this page takes nearly 27 seconds.<sup id=\"fnref-72597-2\"><a href=\"#fn-72597-2\" class=\"jetpack-footnote\" title=\"Read footnote.\">2<\/a><\/sup> Considering more than half of users will abandon a page if it loads for more than three seconds, there was obviously lots of work left to do.<\/p>\n<h2 id=\"a-promising-but-incomplete-solution\"><a class=\"heading-link\" href=\"#a-promising-but-incomplete-solution\">A promising but incomplete solution<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>Enter virtualization. Virtualization is a performance optimization technique that examines the scroll state of the page to determine what content to include in the DOM. For example, if we are viewing a 10,000 line file but only about 75 lines fit on the screen at a time, we can save lots of time by only rendering the lines that fit in the viewport. As the user scrolls, we add any lines that need to appear, and remove any lines that can disappear, as illustrated by this demo.<sup id=\"fnref-72597-3\"><a href=\"#fn-72597-3\" class=\"jetpack-footnote\" title=\"Read footnote.\">3<\/a><\/sup><\/p>\n<p><video width=\"100%\" loop controls autoplay muted><source src=\"https:\/\/github.blog\/wp-content\/uploads\/2023\/06\/virtualization-demo.mp4\" type=\"video\/mp4\"><\/video><\/p>\n<p>This satisfies the most basic requirements of the page with flying colors. It loads on average more quickly than the existing experience, and the experience of scrolling through the file is nearly indistinguishable from the non-virtualized case. Remember that 27 second initial render? Virtualizing the file content gets that time down to under a second, and that number does not increase substantially even if we artificially remove our file size limit and pull in hundreds of megabytes of text.<\/p>\n<p>Unfortunately, virtualization is not a cure-all. While our initial implementation added features to the page at the expense of performance, na\u00efvely virtualizing the code lines delivers a fast experience at the expense of vital functionality. The biggest problem was that without the entire text of the file on the page at once, the browser&#8217;s built-in find-in-file only surfaced results that are visible in the viewport. Breaking users\u2019 ability to find text on the page breaks our hard requirement that the page remain intuitive and easy to use. Before we could ship any of this to real users, we had to ensure that this use case would be covered.<\/p>\n<p>The immediate solution was to implement our own version of find-in-file by implementing a custom handler for the <kbd>Ctrl<\/kbd>+<kbd>F<\/kbd> shortcut (\u2318+<kbd>F<\/kbd> on Mac). We added a new piece of UI in the sidebar to show results as part of our integration with symbol navigation and code search.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/github.blog\/wp-content\/uploads\/2023\/06\/image2-4.png?w=720&#038;resize=720%2C691\" alt=\"Screenshot of the &quot;find&quot; sidebar, showing a search bar with the term &quot;isUn&quot; and a list offive lines of code from the current file that contain that string, the second of which is highlighted as selected.\" width=\"720\" height=\"691\" class=\"aligncenter size-large wp-image-72599 width-fit\" srcset=\"https:\/\/github.blog\/wp-content\/uploads\/2023\/06\/image2-4.png?w=720 720w, https:\/\/github.blog\/wp-content\/uploads\/2023\/06\/image2-4.png?w=300 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>There is precedent for overriding this native browser feature to allow users to find text in virtualized code lines. <a href=\"https:\/\/microsoft.github.io\/monaco-editor\/\">Monaco, the text editor behind VS Code<\/a>, does exactly this to solve the same problem, as do many other online code editors, including <a href=\"https:\/\/replit.com\/\">Repl.it<\/a> and <a href=\"https:\/\/codepen.io\/\">CodePen<\/a>. Some other editors like <a href=\"https:\/\/try.ruby-lang.org\/\">the official Ruby playground<\/a> ignore the problem altogether and accept that <kbd>Ctrl<\/kbd>+<kbd>F<\/kbd> will be partially broken within their virtualized editor.<\/p>\n<p>At the time, we felt confident leaning on this precedent. These examples are applications that run in a browser window, and as users, we expect applications to implement their own controls. Writing our own way to find text on the page was a step toward making GitHub\u2019s Code View less of a web page and more of a web application.<\/p>\n<p>When we released the new code view experience as a private beta at GitHub Universe, we received clear feedback that our users think of GitHub as a page, not as an app. We tried to rework the experience to be as similar as possible to the native implementation, both in terms of user experience and performance. But ultimately, there are plenty of good reasons not to override this kind of native browser behavior.<\/p>\n<ul>\n<li>Users of assistive technologies often use <kbd>Ctrl<\/kbd>+<kbd>F<\/kbd> to locate elements on a page, so restricting the scope to the contents of the file broke these workflows.<\/li>\n<li>Users rely heavily on specific muscle memory for common actions, and we followed a deep rabbit hole to get the custom control to support all of the shortcuts used by various browsers.<\/li>\n<li>Finally, the native browser implementation is simply faster.<\/li>\n<\/ul>\n<p>Despite plenty of precedent for an overridden find experience, this user feedback drove us to dig deeper into how we could lean on the browser for something it already does well.<\/p>\n<p>Virtualization has an important role to play in our final product, but it is only one piece of the puzzle.<\/p>\n<h2 id=\"how-the-pieces-fit-together\"><a class=\"heading-link\" href=\"#how-the-pieces-fit-together\">How the pieces fit together<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>Our complete solution for the code view features two pieces:<\/p>\n<ol>\n<li>A textarea that contains the entire text of the raw file. The contents are accessible, keyboard-navigable, copyable, and findable, yet invisible.<\/li>\n<li>A virtualized, syntax-highlighted overlay. The contents are visible, yet hidden from both mouse events and the browser&#8217;s find.<\/li>\n<\/ol>\n<p>Together, these pieces deliver a code view that supports the complete code reading experience with many new features. Despite the added complexity, this new experience is faster to render than the static HTML page that has displayed code on GitHub for more than a decade.<\/p>\n<h3 id=\"a-textarea-and-a-read-only-cursor\"><a class=\"heading-link\" href=\"#a-textarea-and-a-read-only-cursor\">A textarea and a read-only cursor<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h3>\n<p>The first half of this solution came to us from an unexpected angle.<\/p>\n<p>Beyond adding functionality to the code view, we wanted to improve the code reading experience for users of assistive technologies like screen readers. The previous code view was minimally accessible; a code document was displayed as a table, which created a very surprising experience for screen reader users. A code document is not a table, but likewise it is not a paragraph of text. To support a familiar interface for interacting with the code on the page, we added an invisible textarea underneath the virtualized, syntax-highlighted code lines so that users can move through the code with the keyboard in a familiar way. And for the browser, rendering a textarea is much simpler than using JavaScript to insert syntax-highlighted HTML. Browsers can render megabytes of text in a textarea with ease.<\/p>\n<p>Since this textarea contains the entire text of the raw file, it is not just an accessibility feature, but an opportunity to remove our custom implementation of <kbd>Ctrl<\/kbd>+<kbd>F<\/kbd> in favor of native browser implementations.<\/p>\n<h3 id=\"hiding-text-from-ctrlf\"><a class=\"heading-link\" href=\"#hiding-text-from-ctrlf\">Hiding text from <kbd>Ctrl<\/kbd>+<kbd>F<\/kbd><span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h3>\n<p>With the addition of the textarea, we now have two copies of every line that is visible in the viewport: one in the textarea, and another in the virtualized, syntax-highlighted overlay. In this state, searching for text yields duplicated results, which is more confusing than a slow or unfamiliar experience.<\/p>\n<p>The question, then, is how to expose only one copy of the text to the browser&#8217;s native <kbd>Ctrl<\/kbd>+<kbd>F<\/kbd>. That brings us to the next key part of our solution: how we hid the syntax-highlighted overlay from find.<\/p>\n<p>For a code snippet like this line of Python:<\/p>\n<pre><code class=\"language-python\">print(\"Hello!\")\n<\/code><\/pre>\n<p>the old code view created a bit of HTML that looks like this:<\/p>\n<pre><code class=\"language-python\">&lt;span class=\"pl-en\"&gt;print&lt;\/span&gt;(&lt;span class=\"pl-s\"&gt;\"Hello!\"&lt;\/span&gt;)\n<\/code><\/pre>\n<p>But the text nodes containing <code>print<\/code>, <code>(<\/code>,<code>\"Hello!\"<\/code>, and <code>)<\/code> are all findable. It took two iterations to arrive at a format that looks identical but is consistently hidden from<kbd>Ctrl<\/kbd>+<kbd>F<\/kbd> on all major browsers. And as it turns out, this is not a question that is very easy to research!<\/p>\n<p>The first approach we tried relied on the fact that <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/::before\">:before pseudoelements<\/a> are not part of the DOM, and therefore do not appear in find results. With a bit of a change to our HTML format that moves all text into a <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn\/HTML\/Howto\/Use_data_attributes\">data- attribute<\/a>, we can use CSS to inject the code text into the page without any findable text nodes.<\/p>\n<h4 id=\"html\"><a class=\"heading-link\" href=\"#html\">HTML<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h4>\n<pre><code>&lt;span class=\"pl-en\" data-code-text=\"print\"&gt;&lt;\/span&gt;\n&lt;span data-code-text=\"(\"&gt;&lt;\/span&gt;\n&lt;span class=\"pl-s\" data-code-text=\"\"Hello!\"\"&gt;&lt;\/span&gt;\n&lt;span data-code-text=\")\"&gt;&lt;\/span&gt;\n<\/code><\/pre>\n<h4 id=\"css\"><a class=\"heading-link\" href=\"#css\">CSS<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h4>\n<pre><code>[data-code-text]:before {\n   content: attr(data-code-text);\n}\n<\/code><\/pre>\n<p>But that&#8217;s not the end of the story, because the major browsers do not agree on whether text in :before pseudoelements should be findable; Firefox in particular has a powerful <kbd>Ctrl<\/kbd>+<kbd>F<\/kbd> implementation that is not fooled by our first trick.<\/p>\n<p>Our second attempt relied on a fact on which all browsers seem to agree: that text in adjacent pseudoelements is not treated as a contiguous block of text.<sup id=\"fnref-72597-4\"><a href=\"#fn-72597-4\" class=\"jetpack-footnote\" title=\"Read footnote.\">4<\/a><\/sup> So, even though Firefox would find <strong><code>print<\/code><\/strong> in the first example, it would not find <strong><code>print(<\/code><\/strong>. The solution, then, is to break up the text character-by-character:<\/p>\n<pre><code>&lt;span class=\"pl-en\"&gt;\n   &lt;span data-code-text=\"p\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"r\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"i\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"n\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"t\"&gt;&lt;\/span&gt;\n&lt;\/span&gt;\n&lt;span data-code-text=\"(\"&gt;&lt;\/span&gt;\n&lt;span class=\"pl-s\"&gt;\n   &lt;span data-code-text=\"\"\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"H\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"e\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"l\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"l\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"o\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"!\"&gt;&lt;\/span&gt;\n   &lt;span data-code-text=\"\"\"&gt;&lt;\/span&gt;\n&lt;\/span&gt;\n&lt;span data-code-text=\")\"&gt;&lt;\/span&gt;\n<\/code><\/pre>\n<p>At first glance, this might seem to complicate the DOM so much that it might outweigh the performance gains for which we worked so hard. But since these lines are virtualized, we create this overlay for at most a few hundred lines at a time.<\/p>\n<h3 id=\"syntax-highlighting-in-a-compact-format\"><a class=\"heading-link\" href=\"#syntax-highlighting-in-a-compact-format\">Syntax highlighting in a compact format<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h3>\n<p>The path we took to build a faster code view with more features was, like the path one might follow when reading code in a new repository, highly non-linear. Performance optimizations led us to fix behaviors which were not quite right, and those behavior fixes led us to need further performance optimizations. Knowing how we wanted the HTML for the syntax-highlighted overlay to look, we had a few options for how to make it happen. After a number of experiments, we completed our puzzle with a performance optimization that ended this cycle without causing any behavior changes.<\/p>\n<p>Our syntax-highlighting service previously gave us a list of HTML strings, one for each line of code:<\/p>\n<pre><code>[\n   \"&lt;span class=\\\"pl-en\\\"&gt;print&lt;\/span&gt;(&lt;span class=\\\"pl-s\\\"&gt;\"Hello!\"&lt;\/span&gt;)\"\n]\n<\/code><\/pre>\n<p>In order to display code in a different format, we introduced a new format that simply gives the locations and css classes of highlighted segments:<\/p>\n<pre><code>[\n   [\n       {\"start\": 0, \"end\": 5, \"cssClass\": \"pl-en\"},\n       {\"start\": 6, \"end\": 14, \"cssClass\": \"pl-s\"}\n   ]\n]\n<\/code><\/pre>\n<p>From here, we can easily generate whatever HTML we want. And that brings us to our final optimization:<\/p>\n<p>within our syntax-highlighted overlay, we save React the trouble of managing the code lines by generating the HTML strings ourselves. This can deliver a surprisingly large performance boost in certain cases, like scrolling all the way through the 18,000-line CODEOWNERS file mentioned earlier. With React managing the entire DOM, we hit the \u201cend\u201d key to move all the way to the end of the file, and it takes the browser 870 milliseconds to finish handling the \u201ckeyup\u201d event, followed by 3,700 milliseconds of JavaScript blocking the main thread. When we generate the code lines as HTML strings, handling the \u201ckeyup\u201d event takes only 80 milliseconds, followed by about 700 milliseconds of blocking JavaScript.<sup id=\"fnref-72597-5\"><a href=\"#fn-72597-5\" class=\"jetpack-footnote\" title=\"Read footnote.\">5<\/a><\/sup><\/p>\n<h2 id=\"in-summary\"><a class=\"heading-link\" href=\"#in-summary\">In summary<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h2>\n<p>GitHub\u2019s mission is to be the home for all developers. Developers spend a substantial amount of their time reading code, and reading code is hard! We spent the past year building a new code view that supports the entire code reading experience because we are passionate about bringing great tools to the developers of the world to make their lives a bit easier.<\/p>\n<p>After a lot of difficult work, we have created a code view that introduces tons of new features for understanding code in context, and those features can be used by anyone. And we did it all while also making the page faster!<\/p>\n<p>We\u2019re proud of what we built, and we would love for everyone to try it out and <a href=\"https:\/\/github.com\/orgs\/community\/discussions\/54546\">send us feedback<\/a>!<\/p>\n<p><!-- Footnotes themselves at the bottom. --><\/p>\n<h3 id=\"notes\"><a class=\"heading-link\" href=\"#notes\">Notes<span class=\"heading-hash pl-2 text-italic text-bold\" aria-hidden=\"true\"><\/span><\/a><\/h3>\n<div class=\"footnotes\">\n<hr \/>\n<ol>\n<li id=\"fn-72597-1\">\nThis quote, popularized by and often attributed to Donald Knuth, was first said by Sir Tony Hoare, the developer of the quicksort algorithm.&#160;<a href=\"#fnref-72597-1\" title=\"Return to main content.\">&#8617;<\/a>\n<\/li>\n<li id=\"fn-72597-2\">\nAll performance metrics generated for this post use a development build of React in order to better compare apples to apples.&#160;<a href=\"#fnref-72597-2\" title=\"Return to main content.\">&#8617;<\/a>\n<\/li>\n<li id=\"fn-72597-3\">\n<a href=\"https:\/\/github.com\/jbrown1618\/virtualization-demo\">Check out the source code for this virtualization demo here!<\/a>&#160;<a href=\"#fnref-72597-3\" title=\"Return to main content.\">&#8617;<\/a>\n<\/li>\n<li id=\"fn-72597-4\">\nThe fact that browsers do not treat adjacent :before elements as part of the same block of text also introduces another complication: it resets the tab stop location for each node, which means that tabs are not rendered with the correct width! We need the syntax-highlighted overlay to align exactly with the text content underneath because any discrepancy creates a highly confusing user experience. Luckily, since the overlay is neither findable nor copyable, we can modify it however we like. The tab width problem is solved neatly by converting tabs to the appropriate number of spaces in the overlay.&#160;<a href=\"#fnref-72597-4\" title=\"Return to main content.\">&#8617;<\/a>\n<\/li>\n<li id=\"fn-72597-5\">\nAlthough <em>code<\/em> on GitHub is often nested deeply, the <em>syntax information<\/em> for a line of code can still be described linearly much of the time\u2014we have a keyword followed by some plain text and then a string literal, etc. But sometimes it is not so simple\u2014we might have a Markdown document with a code section. That code section might be an HTML document with a script tag. That script tag might contain JavaScript. That JavaScript might contain doc comments on a function. Those doc comments might contain @param tags which are rendered as keywords. We can handle this kind of arbitrarily nested syntax tree with a recursive React component. But that means the shape of our tree of React nodes, and therefore the amount of time it takes to perform DOM reconciliation, is determined by the code our users have chosen to write. On top of that, React adds DOM nodes one-at-a-time, and our overlay uses one DOM node per character of code. These are the main reasons that sidestepping React for this part of the page gives us such a dramatic performance boost.&#160;<a href=\"#fnref-72597-5\" title=\"Return to main content.\">&#8617;<\/a>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The new GitHub Code View brings users many new features to improve the code reading and exploration experiences, and we overcame a number of unique technical hurdles in order to deliver those features without compromising performance.<\/p>\n","protected":false},"author":2145,"featured_media":71660,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_gh_post_show_toc":"no","_gh_post_is_no_robots":"no","_gh_post_is_featured":"no","_gh_post_is_excluded":"no","_gh_post_is_unlisted":"no","_gh_post_related_link_1":"","_gh_post_related_link_2":"","_gh_post_related_link_3":"","_gh_post_sq_img":"","_gh_post_sq_img_id":"","_gh_post_cta_title":"","_gh_post_cta_text":"","_gh_post_cta_link":"","_gh_post_cta_button":"Click Here to Learn More","_gh_post_recirc_hide":"no","_gh_post_recirc_col_1":"gh-auto-select","_gh_post_recirc_col_2":"65301","_gh_post_recirc_col_3":"65312","_gh_post_recirc_col_4":"65316","_featured_video":"","_gh_post_additional_query_params":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[3307,72],"tags":[2313,2311,2914],"coauthors":[3083],"class_list":["post-72597","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-architecture-optimization","category-engineering","tag-code-navigation","tag-code-search","tag-code-view"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.7 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Crafting a better, faster code view - The GitHub Blog<\/title>\n<meta name=\"description\" content=\"The new GitHub Code View brings users many new features to improve the code reading and exploration experiences, and we overcame a number of unique technical hurdles in order to deliver those features without compromising performance.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Crafting a better, faster code view\" \/>\n<meta property=\"og:description\" content=\"The new GitHub Code View brings users many new features to improve the code reading and exploration experiences, and we overcame a number of unique technical hurdles in order to deliver those features without compromising performance.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/\" \/>\n<meta property=\"og:site_name\" content=\"The GitHub Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-21T17:35:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/github.blog\/wp-content\/uploads\/2023\/05\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Joshua Brown\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joshua Brown\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/\"},\"author\":{\"name\":\"Joshua Brown\",\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/4e02486940b06fc6d5a3cbca3c386c87\"},\"headline\":\"Crafting a better, faster code view\",\"datePublished\":\"2023-06-21T17:35:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/\"},\"wordCount\":2771,\"image\":{\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260\",\"keywords\":[\"code navigation\",\"code search\",\"code view\"],\"articleSection\":[\"Architecture &amp; optimization\",\"Engineering\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/\",\"url\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/\",\"name\":\"Crafting a better, faster code view - The GitHub Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/github.blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260\",\"datePublished\":\"2023-06-21T17:35:17+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/4e02486940b06fc6d5a3cbca3c386c87\"},\"description\":\"The new GitHub Code View brings users many new features to improve the code reading and exploration experiences, and we overcame a number of unique technical hurdles in order to deliver those features without compromising performance.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/#primaryimage\",\"url\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260\",\"contentUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260\",\"width\":2400,\"height\":1260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/crafting-a-better-faster-code-view\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/github.blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Engineering\",\"item\":\"https:\\\/\\\/github.blog\\\/engineering\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Architecture &amp; optimization\",\"item\":\"https:\\\/\\\/github.blog\\\/engineering\\\/architecture-optimization\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Crafting a better, faster code view\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/github.blog\\\/#website\",\"url\":\"https:\\\/\\\/github.blog\\\/\",\"name\":\"The GitHub Blog\",\"description\":\"Updates, ideas, and inspiration from GitHub to help developers build and design software.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/github.blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/github.blog\\\/#\\\/schema\\\/person\\\/4e02486940b06fc6d5a3cbca3c386c87\",\"name\":\"Joshua Brown\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49816eb66b24933001fea8d71477551b2b296305f89c9e42bf471553a28f2e4b?s=96&d=mm&r=ga05e71aa0aa1d9afa26a342fc5b23606\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49816eb66b24933001fea8d71477551b2b296305f89c9e42bf471553a28f2e4b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49816eb66b24933001fea8d71477551b2b296305f89c9e42bf471553a28f2e4b?s=96&d=mm&r=g\",\"caption\":\"Joshua Brown\"},\"url\":\"https:\\\/\\\/github.blog\\\/author\\\/jbrown1618\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Crafting a better, faster code view - The GitHub Blog","description":"The new GitHub Code View brings users many new features to improve the code reading and exploration experiences, and we overcame a number of unique technical hurdles in order to deliver those features without compromising performance.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/","og_locale":"en_US","og_type":"article","og_title":"Crafting a better, faster code view","og_description":"The new GitHub Code View brings users many new features to improve the code reading and exploration experiences, and we overcame a number of unique technical hurdles in order to deliver those features without compromising performance.","og_url":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/","og_site_name":"The GitHub Blog","article_published_time":"2023-06-21T17:35:17+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/github.blog\/wp-content\/uploads\/2023\/05\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260","type":"image\/png"}],"author":"Joshua Brown","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Joshua Brown","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/#article","isPartOf":{"@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/"},"author":{"name":"Joshua Brown","@id":"https:\/\/github.blog\/#\/schema\/person\/4e02486940b06fc6d5a3cbca3c386c87"},"headline":"Crafting a better, faster code view","datePublished":"2023-06-21T17:35:17+00:00","mainEntityOfPage":{"@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/"},"wordCount":2771,"image":{"@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2023\/05\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260","keywords":["code navigation","code search","code view"],"articleSection":["Architecture &amp; optimization","Engineering"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/","url":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/","name":"Crafting a better, faster code view - The GitHub Blog","isPartOf":{"@id":"https:\/\/github.blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/#primaryimage"},"image":{"@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2023\/05\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260","datePublished":"2023-06-21T17:35:17+00:00","author":{"@id":"https:\/\/github.blog\/#\/schema\/person\/4e02486940b06fc6d5a3cbca3c386c87"},"description":"The new GitHub Code View brings users many new features to improve the code reading and exploration experiences, and we overcame a number of unique technical hurdles in order to deliver those features without compromising performance.","breadcrumb":{"@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/#primaryimage","url":"https:\/\/github.blog\/wp-content\/uploads\/2023\/05\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260","contentUrl":"https:\/\/github.blog\/wp-content\/uploads\/2023\/05\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260","width":2400,"height":1260},{"@type":"BreadcrumbList","@id":"https:\/\/github.blog\/engineering\/architecture-optimization\/crafting-a-better-faster-code-view\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/github.blog\/"},{"@type":"ListItem","position":2,"name":"Engineering","item":"https:\/\/github.blog\/engineering\/"},{"@type":"ListItem","position":3,"name":"Architecture &amp; optimization","item":"https:\/\/github.blog\/engineering\/architecture-optimization\/"},{"@type":"ListItem","position":4,"name":"Crafting a better, faster code view"}]},{"@type":"WebSite","@id":"https:\/\/github.blog\/#website","url":"https:\/\/github.blog\/","name":"The GitHub Blog","description":"Updates, ideas, and inspiration from GitHub to help developers build and design software.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/github.blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/github.blog\/#\/schema\/person\/4e02486940b06fc6d5a3cbca3c386c87","name":"Joshua Brown","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/49816eb66b24933001fea8d71477551b2b296305f89c9e42bf471553a28f2e4b?s=96&d=mm&r=ga05e71aa0aa1d9afa26a342fc5b23606","url":"https:\/\/secure.gravatar.com\/avatar\/49816eb66b24933001fea8d71477551b2b296305f89c9e42bf471553a28f2e4b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/49816eb66b24933001fea8d71477551b2b296305f89c9e42bf471553a28f2e4b?s=96&d=mm&r=g","caption":"Joshua Brown"},"url":"https:\/\/github.blog\/author\/jbrown1618\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/github.blog\/wp-content\/uploads\/2023\/05\/1200.630-Productivity-wLogo@2x.png?fit=2400%2C1260","jetpack_shortlink":"https:\/\/wp.me\/pamS32-iSV","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/72597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/users\/2145"}],"replies":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/comments?post=72597"}],"version-history":[{"count":7,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/72597\/revisions"}],"predecessor-version":[{"id":72602,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/posts\/72597\/revisions\/72602"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/media\/71660"}],"wp:attachment":[{"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/media?parent=72597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/categories?post=72597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/tags?post=72597"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/github.blog\/wp-json\/wp\/v2\/coauthors?post=72597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}