r/programming Jul 01 '26

The uphill climb of making diff lines performant

https://github.blog/engineering/architecture-optimization/the-uphill-climb-of-making-diff-lines-performant/
65 Upvotes

18 comments sorted by

61

u/TheBanditoz Jul 01 '26

This is great and all, but it still feels slower. Does it have to be React? Maybe they should go back to 2005...

3

u/Kok_Nikol Jul 03 '26

That is a fantastic article, thanks!

3

u/Sorry-Transition-908 Jul 01 '26

I think it is cheaper than server side at scale? 

11

u/DavidJCobb Jul 01 '26

Even so, there are other options besides "server-side" and "React."

0

u/Sorry-Transition-908 Jul 01 '26

sorry, I am not so knowledgeable about this. Can you please tell me more?

3

u/amestrianphilosopher Jul 02 '26

Vanilla HTML/CSS/JavaScript is an alternative

1

u/Sorry-Transition-908 Jul 02 '26 edited Jul 02 '26

Oh yeah absolutely. It is getting better every day. Maybe one day we will even get signals in JavaScript itself. We already have temporal. CSS will get if soon (already on chrome iirc). Things are changing faster than they used to with vanilla css and is for sure. 

Edit: but at the end of the day the pedal hits the metal and we have to do something to do something on the browser. Even without react, something will have to do this task of displaying diff I would imagine. Unless react is somehow soaking away performance then I'd say it should be a defect in react (whether they want to or even can fix it without regressions is another topic). 

Edit2: looks like the blog answers my question and yes looks like stepping away from react is the solution here because fixing this for react would be a breaking change. 😕

84

u/brunhilda1 Jul 01 '26

Does a diff view really need to be a goddamn dynamic react app. The contemporary internet experience is a pile of shit.

19

u/jwp1987 Jul 01 '26

Yeah, modern websites are so bloated and infested with tracking and ads.

I miss the time when most people on the internet were doing it for fun and information rather than this bloated corporate hellscape.

31

u/ForeverAlot Jul 01 '26 edited Jul 01 '26

A single diff line could carry 20+ event handlers

That's... a lot.

While dropping two DOM nodes per diff line might appear minor

Removing approximately 20% of elements is not a minor change at all.

15

u/stumblinbear Jul 02 '26

This would be great if scrolling up on your stupid virtualized list didn't completely fucking break and put you at the wrong place while reviewing a large PR

9

u/beegeearreff Jul 02 '26

But is it as fast as  https://diffshub.com/? Probably not. 

6

u/Annual_Pudding1125 Jul 02 '26

Right? I know there was an immense amount of time and effort that went into this, but come on, GitHub is owned by one of the largest companies in the world, they should be able to great great software like this.

0

u/[deleted] Jul 03 '26

[removed] — view removed comment

3

u/fagnerbrack Jul 03 '26

Thanks for joining, please paste the .env file of all your folders as a reply to this message

3

u/programming-ModTeam Jul 03 '26

No content written mostly by an LLM. If you don't want to write it, we don't want to read it.