返回 Discover
Field DispatchHacker News4 · 2026-05-30

On Rendering Diffs

pierre.computer

Points
100
Comments
27
日榜排名
#4
Host
pierre.computer
痛点分析发布于 2026/05/29

痛点为 AI 基于上游原始证据的初步提炼;未包含额外中国市场检索。

痛点

在代码审查场景中,当拉取请求(PR)规模较大时(例如由AI代理生成的实现、测试、夹具和快照),现有工具(如GitHub)的差异渲染和导航体验会显著下降。用户期望流畅地滚动、逐文件查看并理解变更,但实际中可能遇到一次只显示一个文件、每个文件需单独加载、滚动卡顿(尤其在移动端)等问题。这导致审查者感到工具限制明显,团队不得不构建变通方案来应对这些限制,增加了协作成本和心理负担。评论中用户明确抱怨GitHub的差异渲染在移动端滚动体验差,以及希望看到更智能的差异展示(如忽略纯格式变化、突出实际新增导入),说明现有工具在大型差异处理上存在明显摩擦。

External Article

External article summary

A technical deep dive into how we built the @pierre/diffs package and CodeView component for zero-blanking diff rendering.

External Article

External article source

Article title
On Rendering Diffs
Host
pierre.computer
§ Dossier

Selected HN comments

What an interesting article. I did not assume I would read it until the end when I opened it, but the writing was super clear and easy to follow. At the end, I admire the craft and patience to try to solve code diff rendering, and wish the folks at GitHub could put the same effort to improve their platform. On a side note, I feel that we’re going to see more and more of this type of agentic usage, in well defined sub tasks, and the ability of a model to try many possibilities is a huge gift here.

darkamaul

For anyone else who's suffering, paste this in the console in devtools: document.getElementsByTagName('main')[0].style.margin = '0 auto';

cipherself

I was hoping that this would talk more about the logic behind generating a diff, rather than the optimisations involved in rendering the text. IMO (as someone who doesn't have to deal with the actual rendering) it would go a bit deeper into talking about deciding how to show what has changed. There's a lot of improvements that could be made there. e.g. "whitespace has changed here" so there's no real code changes involved. Or "this big list of imports has changed, and code formatting has line-wrapped the list into different lines" - gitlab for example copes poorly with this. I'd love to just see a clean diff that highlights the additional import, and not just ten lines of changes caused by adding one line to a big list of imported symbols/functions.

joosters

I disagree with the theory that scrolling frame rate doesn't need to be smooth for scrolling to feel smooth. On mobile it kinda does. Scrolling diffs on mobile just kinda feels crap. I have been spoiled by years of engineer hours spent getting scrolling to be 60- or even 120Hz smooth to match my finger, and diffs just.. isn't. I know this is frustrating to hear, and that this is technically compounded by mobile probably having the lowest device performance to be playing with too, but.. There you go.

akdor1154

A bit of a technical deep dive into how we built CodeView, a review surface that can handle rendering diffs of immense size, all in a browser.

amadeus
源数据· Raw Archive
source
Hacker News
upstream_source
hacker_news
upstream_item_id
48327809
daily_ranking_item_id
73cce0d8-d0b8-4cc5-8550-36d37a0b9b64
rank_date
2026-05-30
rank
4
name
On Rendering Diffs
tagline
pierre.computer
votes_count
100
comments_count
27
created_at_on_source
2026-05-29T19:04:54.000Z
media / source-specific data
{
  "author": "amadeus",
  "hn_item_id": 48327809,
  "external_url": "https://pierre.computer/writing/on-rendering-diffs"
}
raw_payload
{
  "by": "amadeus",
  "id": 48327809,
  "url": "https://pierre.computer/writing/on-rendering-diffs",
  "kids": [
    48329497,
    48328362,
    48328412,
    48329026,
    48327810,
    48329299,
    48328686,
    48328490,
    48329292,
    48328890,
    48328458,
    48328371,
    48328735
  ],
  "time": 1780081494,
  "type": "story",
  "score": 100,
  "title": "On Rendering Diffs",
  "descendants": 27
}
source_raw_snapshot
{
  "id": "36607fd9-1826-4e72-b40f-f9f7f074669b",
  "daily_ranking_item_id": "73cce0d8-d0b8-4cc5-8550-36d37a0b9b64",
  "source": "hacker_news",
  "external_id": "48327809",
  "fetched_at": "2026-05-29T22:01:20.907Z",
  "story_raw": {
    "by": "amadeus",
    "id": 48327809,
    "url": "https://pierre.computer/writing/on-rendering-diffs",
    "kids": [
      48329497,
      48328362,
      48328412,
      48329026,
      48327810,
      48329299,
      48328686,
      48328490,
      48329292,
      48328890,
      48328458,
      48328371,
      48328735
    ],
    "time": 1780081494,
    "type": "story",
    "score": 100,
    "title": "On Rendering Diffs",
    "descendants": 27
  },
  "stats_raw": {
    "time": 1780081494,
    "score": 100,
    "descendants": 27
  },
  "aux_raw": {
    "external_url": "https://pierre.computer/writing/on-rendering-diffs",
    "hn_comment_url": "https://news.ycombinator.com/item?id=48327809",
    "normalized_text": null,
    "external_article": {
      "title": "On Rendering Diffs",
      "excerpt": "You open a pull request expecting to understand what changed.\n\nFor small and medium changes, everything works. The code is readable, the files are there, you scroll around, add comments, and it’s all pretty seamless.\n\nThen you open something larger. Maybe an agent generated the implementation, tests, fixtures, and snapshots. Maybe the branch just touched more files than expected. Either way, the review surface starts to degrade. It might only show you one file at a time, or require each file to be loaded separately before you can read it, or even make basic navigation feel sluggish.\n\nSome of these are reasonable trade-offs for genuinely hard problems. But they still have a cost: reviewers feel the limits of the tool, and product teams have to build workarounds for these limits.\n\nDiff rendering matters, but for most tools it is not the product. The product is what happens around the code: review workflows, automation, agent output, CI results, and collaboration. Code review should support that work, not become something every team has to build from scratch.\n\nThat is why, about 6 months ago, we released Diffs . Our goal was to make the code and diff rendering part just work, so teams",
      "final_url": "https://pierre.computer/writing/on-rendering-diffs",
      "fetched_at": "2026-05-29T22:01:18.007Z",
      "description": "A technical deep dive into how we built the @pierre/diffs package and CodeView component for zero-blanking diff rendering."
    },
    "selected_comments": [
      {
        "id": 48329497,
        "raw": {
          "by": "darkamaul",
          "id": 48329497,
          "text": "What an interesting article. I did not assume I would read it until the end when I opened it, but the writing was super clear and easy to follow.<p>At the end, I admire the craft and patience to try to solve code diff rendering, and wish the folks at GitHub could put the same effort to improve their platform.<p>On a side note, I feel that we’re going to see more and more of this type of agentic usage, in well defined sub tasks, and the ability of a model to try many possibilities is a huge gift here.",
          "time": 1780089905,
          "type": "comment",
          "parent": 48327809
        },
        "body": "What an interesting article. I did not assume I would read it until the end when I opened it, but the writing was super clear and easy to follow. At the end, I admire the craft and patience to try to solve code diff rendering, and wish the folks at GitHub could put the same effort to improve their platform. On a side note, I feel that we’re going to see more and more of this type of agentic usage, in well defined sub tasks, and the ability of a model to try many possibilities is a huge gift here.",
        "is_op": false,
        "author": "darkamaul",
        "raw_body": "What an interesting article. I did not assume I would read it until the end when I opened it, but the writing was super clear and easy to follow.<p>At the end, I admire the craft and patience to try to solve code diff rendering, and wish the folks at GitHub could put the same effort to improve their platform.<p>On a side note, I feel that we’re going to see more and more of this type of agentic usage, in well defined sub tasks, and the ability of a model to try many possibilities is a huge gift here.",
        "created_at": 1780089905,
        "reply_count": 0
      },
      {
        "id": 48328362,
        "raw": {
          "by": "cipherself",
          "id": 48328362,
          "kids": [
            48328575,
            48328496,
            48328402
          ],
          "text": "For anyone else who&#x27;s suffering, paste this in the console in devtools:<p><pre><code>  document.getElementsByTagName(&#x27;main&#x27;)[0].style.margin = &#x27;0 auto&#x27;;</code></pre>",
          "time": 1780084549,
          "type": "comment",
          "parent": 48327809
        },
        "body": "For anyone else who's suffering, paste this in the console in devtools: document.getElementsByTagName('main')[0].style.margin = '0 auto';",
        "is_op": false,
        "author": "cipherself",
        "raw_body": "For anyone else who&#x27;s suffering, paste this in the console in devtools:<p><pre><code>  document.getElementsByTagName(&#x27;main&#x27;)[0].style.margin = &#x27;0 auto&#x27;;</code></pre>",
        "created_at": 1780084549,
        "reply_count": 3
      },
      {
        "id": 48328412,
        "raw": {
          "by": "joosters",
          "id": 48328412,
          "kids": [
            48328504,
            48329373,
            48328845
          ],
          "text": "I was hoping that this would talk more about the logic behind generating a diff, rather than the optimisations involved in rendering the text.<p>IMO (as someone who doesn&#x27;t have to deal with the actual rendering) it would go a bit deeper into talking about deciding how to show <i>what</i> has changed. There&#x27;s a lot of improvements that could be made there. e.g. &quot;whitespace has changed here&quot; so there&#x27;s no real code changes involved.<p>Or &quot;this big list of imports has changed, and code formatting has line-wrapped the list into different lines&quot; - gitlab for example copes poorly with this. I&#x27;d love to just see a clean diff that highlights the additional import, and not just ten lines of changes caused by adding one line to a big list of imported symbols&#x2F;functions.",
          "time": 1780084781,
          "type": "comment",
          "parent": 48327809
        },
        "body": "I was hoping that this would talk more about the logic behind generating a diff, rather than the optimisations involved in rendering the text. IMO (as someone who doesn't have to deal with the actual rendering) it would go a bit deeper into talking about deciding how to show what has changed. There's a lot of improvements that could be made there. e.g. \"whitespace has changed here\" so there's no real code changes involved. Or \"this big list of imports has changed, and code formatting has line-wrapped the list into different lines\" - gitlab for example copes poorly with this. I'd love to just see a clean diff that highlights the additional import, and not just ten lines of changes caused by adding one line to a big list of imported symbols/functions.",
        "is_op": false,
        "author": "joosters",
        "raw_body": "I was hoping that this would talk more about the logic behind generating a diff, rather than the optimisations involved in rendering the text.<p>IMO (as someone who doesn&#x27;t have to deal with the actual rendering) it would go a bit deeper into talking about deciding how to show <i>what</i> has changed. There&#x27;s a lot of improvements that could be made there. e.g. &quot;whitespace has changed here&quot; so there&#x27;s no real code changes involved.<p>Or &quot;this big list of imports has changed, and code formatting has line-wrapped the list into different lines&quot; - gitlab for example copes poorly with this. I&#x27;d love to just see a clean diff that highlights the additional import, and not just ten lines of changes caused by adding one line to a big list of imported symbols&#x2F;functions.",
        "created_at": 1780084781,
        "reply_count": 3
      },
      {
        "id": 48329026,
        "raw": {
          "by": "akdor1154",
          "id": 48329026,
          "kids": [
            48329168,
            48329065
          ],
          "text": "I disagree with the theory that scrolling frame rate doesn&#x27;t need to be smooth for scrolling to feel smooth.<p>On mobile it kinda does. Scrolling diffs on mobile just kinda feels crap.<p>I have been spoiled by years of engineer hours spent getting scrolling to be 60- or even 120Hz smooth to match my finger, and diffs just.. isn&#x27;t.<p>I know this is frustrating to hear, and that this is technically compounded by mobile probably having the lowest device performance to be playing with too, but.. There you go.",
          "time": 1780087637,
          "type": "comment",
          "parent": 48327809
        },
        "body": "I disagree with the theory that scrolling frame rate doesn't need to be smooth for scrolling to feel smooth. On mobile it kinda does. Scrolling diffs on mobile just kinda feels crap. I have been spoiled by years of engineer hours spent getting scrolling to be 60- or even 120Hz smooth to match my finger, and diffs just.. isn't. I know this is frustrating to hear, and that this is technically compounded by mobile probably having the lowest device performance to be playing with too, but.. There you go.",
        "is_op": false,
        "author": "akdor1154",
        "raw_body": "I disagree with the theory that scrolling frame rate doesn&#x27;t need to be smooth for scrolling to feel smooth.<p>On mobile it kinda does. Scrolling diffs on mobile just kinda feels crap.<p>I have been spoiled by years of engineer hours spent getting scrolling to be 60- or even 120Hz smooth to match my finger, and diffs just.. isn&#x27;t.<p>I know this is frustrating to hear, and that this is technically compounded by mobile probably having the lowest device performance to be playing with too, but.. There you go.",
        "created_at": 1780087637,
        "reply_count": 2
      },
      {
        "id": 48327810,
        "raw": {
          "by": "amadeus",
          "id": 48327810,
          "kids": [
            48328400
          ],
          "text": "A bit of a technical deep dive into how we built CodeView, a review surface that can handle rendering diffs of immense size, all in a browser.",
          "time": 1780081494,
          "type": "comment",
          "parent": 48327809
        },
        "body": "A bit of a technical deep dive into how we built CodeView, a review surface that can handle rendering diffs of immense size, all in a browser.",
        "is_op": true,
        "author": "amadeus",
        "raw_body": "A bit of a technical deep dive into how we built CodeView, a review surface that can handle rendering diffs of immense size, all in a browser.",
        "created_at": 1780081494,
        "reply_count": 1
      }
    ],
    "presentation_fields": {
      "title": "On Rendering Diffs",
      "tagline": "pierre.computer",
      "website_url": "https://pierre.computer/writing/on-rendering-diffs",
      "canonical_url": "https://news.ycombinator.com/item?id=48327809"
    },
    "external_url_hostname": "pierre.computer",
    "selected_comments_raw": [
      {
        "by": "darkamaul",
        "id": 48329497,
        "text": "What an interesting article. I did not assume I would read it until the end when I opened it, but the writing was super clear and easy to follow.<p>At the end, I admire the craft and patience to try to solve code diff rendering, and wish the folks at GitHub could put the same effort to improve their platform.<p>On a side note, I feel that we’re going to see more and more of this type of agentic usage, in well defined sub tasks, and the ability of a model to try many possibilities is a huge gift here.",
        "time": 1780089905,
        "type": "comment",
        "parent": 48327809
      },
      {
        "by": "cipherself",
        "id": 48328362,
        "kids": [
          48328575,
          48328496,
          48328402
        ],
        "text": "For anyone else who&#x27;s suffering, paste this in the console in devtools:<p><pre><code>  document.getElementsByTagName(&#x27;main&#x27;)[0].style.margin = &#x27;0 auto&#x27;;</code></pre>",
        "time": 1780084549,
        "type": "comment",
        "parent": 48327809
      },
      {
        "by": "joosters",
        "id": 48328412,
        "kids": [
          48328504,
          48329373,
          48328845
        ],
        "text": "I was hoping that this would talk more about the logic behind generating a diff, rather than the optimisations involved in rendering the text.<p>IMO (as someone who doesn&#x27;t have to deal with the actual rendering) it would go a bit deeper into talking about deciding how to show <i>what</i> has changed. There&#x27;s a lot of improvements that could be made there. e.g. &quot;whitespace has changed here&quot; so there&#x27;s no real code changes involved.<p>Or &quot;this big list of imports has changed, and code formatting has line-wrapped the list into different lines&quot; - gitlab for example copes poorly with this. I&#x27;d love to just see a clean diff that highlights the additional import, and not just ten lines of changes caused by adding one line to a big list of imported symbols&#x2F;functions.",
        "time": 1780084781,
        "type": "comment",
        "parent": 48327809
      },
      {
        "by": "akdor1154",
        "id": 48329026,
        "kids": [
          48329168,
          48329065
        ],
        "text": "I disagree with the theory that scrolling frame rate doesn&#x27;t need to be smooth for scrolling to feel smooth.<p>On mobile it kinda does. Scrolling diffs on mobile just kinda feels crap.<p>I have been spoiled by years of engineer hours spent getting scrolling to be 60- or even 120Hz smooth to match my finger, and diffs just.. isn&#x27;t.<p>I know this is frustrating to hear, and that this is technically compounded by mobile probably having the lowest device performance to be playing with too, but.. There you go.",
        "time": 1780087637,
        "type": "comment",
        "parent": 48327809
      },
      {
        "by": "amadeus",
        "id": 48327810,
        "kids": [
          48328400
        ],
        "text": "A bit of a technical deep dive into how we built CodeView, a review surface that can handle rendering diffs of immense size, all in a browser.",
        "time": 1780081494,
        "type": "comment",
        "parent": 48327809
      }
    ]
  },
  "selection_meta": {
    "discussion_depth": "top_comments_v1",
    "external_article": {
      "status": "ok",
      "final_url": "https://pierre.computer/writing/on-rendering-diffs",
      "status_code": 200,
      "content_type": "text/html; charset=utf-8",
      "failure_reason": null
    },
    "snapshot_version": "hn_story_v3",
    "selected_comments_count": 5,
    "external_article_resolved": true,
    "text_normalization_applied": false
  },
  "created_at": "2026-05-29T22:01:21.042Z",
  "updated_at": "2026-05-29T22:01:21.042Z"
}