1 comment

[ 3.0 ms ] story [ 10.4 ms ] thread
The article does not explain why Git is that much more efficient. It has some thoughts in the right direction though.

Obviously, SVN and Git have different delta-compression techniques. For a given SRC and DST files, Git's algorithm puts COPY instruction from any position at SRC file. Subversion however restricts COPY instructions to be sequential, i.e. the consumer of generated instruction stream doesn't perform random reads at SRC in order to produce DST.

For the sake of simplicity, let SRC='aabc' and DST='aaxyaa':

Git instruction stream:

  COPY   'aa'
  INSERT 'xy'
  COPY   'aa'
SVN instruction stream:

  COPY   'aa'
  INSERT 'xyaa'
As result delta-encoded DST file is more compact in Git repository than in Subversion. What are the drawbacks of Git's approach? Good exercise for the reader.