The sorry state of visual diff tools for Linux

I've used a visual diff tool for Windows called CompareIt! for 10 (ten) years, until I migrated to Linux. It's an excellent tool, and the fastest I've ever found - it compares two 50k-line CSV files in about one second. This is orders of magnitude faster than the fastest diff tools on Linux.

CompareIt! works on Linux via wine (as long as you convert the file paths). It also has a bunch of really useful features:

  • Manual alignment, to give the tool a hint when it is thrown off by some false match
  • Highlight the current line - great for files with long lines
  • Show the current lines in a panel at the bottom of the window, so you can inspect inline differences easily. A must-have for comparing files with long lines, especially CSVs.
  • Customizable keyboard shortcuts
  • Regular expressions to ignore certain parts of each line
  • Syntax highlight
  • Built-in editor

Even though it hasn't been developed since 2009, CompareIt! doesn't really need much development. The UI isn't as pretty as Meld's, but it's perfectly functional.

Alas, if you're looking for a native Linux visual diff tool that doesn't suck at comparing CSV files, it's impossible to find one nearly as good as CompareIt!.

Linux diff tool benchmarks

Given these two CSV files that only differ in the date format (YYYY-MM-DD HH:MM:SS vs M/D/YYYY HH:MM), here's how the most popular Linux diff tools stack up:

  • Thumbs down Meld - never finishes
  • Thumbs down Beyond Compare thinks the files are completely different because it assumes the first column is the key. There's no command line option to change that. You might some some luck manually aligning the files, but that defeats the point of using the tool.
  • Thumbs down Kompare chokes
  • Thumbs down WinMerge (via wine) takes longer than a minute, at which point I force quit it
  • Thumbs down KDiff3 takes 25 seconds
  • Thumbs down P4Merge takes 6 seconds (and over 150MB to install it)
  • Thumbs down SmartSynchronize takes 4.5 seconds (and clutters your terminal with its debugging info)
  • TkDiff - 6.5 seconds
  • Diffuse takes 1.5 seconds, and supports manual line alignment. It's unfortunately unusable for files with long lines.
  • xxdiff - I couldn't compile it
  • CompareIt! (run with wine) takes half a second and is the best diffing tool I've used. The only downsides are it's not native to Linux so you'll have problems with paths, and that it doesn't show the nice bubble-shaped display for moved lines that's modern nowadays:
    nice diff bubbles

How the winners suck

Now let's look at the diff tools that aren't so slow that you just can't use them: P4Merge, SmartSynchronize, Diffuse. Not a long list :-(

Diffuse

The fastest of the lot, Diffuse is also impossible to use on CSV files with long lines. Here's how Diffuse looks when the lines are wider than the window:

Diffuse has no wrapping or line-vs-line comparison

Nope, there's no wrapping. And the current lines can't be compared on top of each other. Scrolling horizontally is a poor solution if the lines got out of sync (e.g. 20-40 characters inserted into one of them) and there are many different lines in the current chunk.

CompareIt! solves this problem by showing the current lines on top of each other, with the inline differences highlighted:

Compare the two active lines

P4Merge

Surprisingly (mind-bogglingly even, when you consider that Perforce has been developed since 2002!), P4Merge doesn't let you diff long lines either. It also can't highlight the current line. WTF (users on their forum suggested using a smaller font). How can you tell what's different below?

P4Merge is an unusable piece of shit

TkDiff

This is just a GUI around the diff command. It does have a line comparison window at the bottom, but the comparison within that is completely off:

TkDiff line comparison sucks

You can't highlight the current line, and the keyboard shortcuts are not customizable.

Conclusion

There is either no decent visual diff tool for Linux, or if there is one, it's so unpopular it hasn't made it into alternativeTo.

This is a surprising case of open source failure. Diffing is at the core of version control in software development, yet there is no clear winner in the space. Moreover, none of the tools above have a decent presence on GitHub (which probably is a reason for this failure).

If you do know of a Linux diff tool that doesn't suck at comparing CSV files, please do leave a comment below. In the meantime I'm still using the good old CompareIt! with Wine.

My tags:
 
Popular tags: