• Adding a line: ✅
  • Removing a line: ✅
  • Modifying a line: ✅
  • Moving a codeblock: ❌ i see you’ve rewritten everything, let me just highlight it all.

RIP reviewers on my PR.

(Meme created by my coworker)

You are viewing a single thread.
View all comments
34 points

I’m convinced there must be a way of using ASTs to do more intelligent diffing of a given programming language, but I’m far too lazy to find out for myself.

permalink
report
reply
51 points

You mean like Difftastic?

permalink
report
parent
reply
24 points

Hell yeah, being lazy paid off. Thanks.

permalink
report
parent
reply
7 points

You’re welcome. And have fun trying to break it!

permalink
report
parent
reply
11 points

There is, but your dif tool would have to be language aware and likely be slower to show difs.

permalink
report
parent
reply
6 points

There have been some attempts at semantic diffs, but it’s very uhh… difficult to gain traction with such a thing.

permalink
report
parent
reply
5 points

Diffing algorithms on trees might not be as efficient, especially if they have to find arbitrary node moves.

permalink
report
parent
reply
2 points

I wouldn’t expect it to be, but I think modern processors can handle the load!

permalink
report
parent
reply
2 points

It’s not necessarily about the load, it’s about the algorithmic complexity. Going from lists (lines in a file, characters in a line) to trees introduces a potentially exponential increase in complexity due to the number of ways the same list of elements can be organized into a tree.

Also, you’re underestimating the amount of processing. It’s not about pure CPU computations but RAM access or even I/O. Even existing non-semantic diff implementations are unexpectedly inadequate in terms of performance. You clearly haven’t tried diffing multi-GB log files.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 6.8K

    Monthly active users

  • 1.4K

    Posts

  • 32K

    Comments