Johan Kiviniemi’s series of tubes

The speed difference between svn diff and git diff

2008-01-10

svn diff in a SVN checkout of https://panotools.svn.sourceforge.net/svnroot/panotools/trunk/libpano:

% time svn diff -r 706 >/dev/null
svn diff -r 706 > /dev/null  0.40s user 0.14s system 1% cpu 42.378 total

The equivalent git diff in a Git branch imported from the same SVN branch:

% time git diff $(git svn find-rev r706) >/dev/null
git diff $(git svn find-rev r706) > /dev/null  0.19s user 0.04s system 85% cpu 0.276 total

(Both are the fastest of four subsequent tries, but the differences were negligible.)

A 15000% difference. Really. Just because SVN requires network access for this functionality (and pretty much everything else). The entire Git suite is just insanely fast compared to the competition, not to mention that it handles things like branching and merging in a refreshingly pleasant way.

A git diff from the project’s very first SVN revision:

% time git diff $(git svn find-rev r29) >/dev/null
git diff $(git svn find-rev r29) > /dev/null  0.38s user 0.04s system 95% cpu 0.434 total

Still less than half a second.

I recommend watching Linus Torvalds’ entertaining tech talk about Git (download flv), no matter which VCS you’re using.

© 2011 Johan Kiviniemi

The image of a giraffe is from Wikimedia Commons