git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: diff'ing files ...

From
Nicolas Pitre <nico@fluxnic.net>
Date
Jun 10, 2011, 20:37 UTC
Message-ID
<alpine.LFD.2.00.1106101612060.2142@xanadu.home>
In-Reply-To
<m34o3xesqn.fsf@localhost.localdomain>
On Fri, 10 Jun 2011, Jakub Narebski wrote:
Show 19 quoted lines
> Nicolas Pitre <nico@fluxnic.net> writes:
> > The libxdiff code was pretty generic so to be highly portable and usable 
> > for many application types.  What I did is to get rid of everything that 
> > git strictly didn't need in order to make the code as simple as 
> > possible, and most importantly as fast as possible. [...]
> > 
> > And then further modifications were made to avoid pathological corner 
> > cases which were taking too much time for little gain in the Git 
> > context.
> > 
> > I also changed the output encoding to make it tighter.
> 
> Nicolas, do you know how binary diff used by git compares with respect
> to performance and compression with other binary diff algorithms:
> 
>   * original LibXDiff
>   * bsdiff
>   * xdelta (vcdif algorithm)
>   * vbindiff

No idea. But you can test that pretty easily if you wish. I would be interested in the results of course. Just do:

	make test-delta
and then, to compress something:
	./test-delta -d <input_file> <reference_file> <output_file>

Of course this will produce <output_file> which is only the bare binary diff annotation data against the reference file. In Git that output is also deflated with zlib, before it is stored in a pack. The other binary diff tools are usually doing a similar post-deflation pass as well.

It should be noted that the algorithm that Git uses won't produce the absolute smallest output. When I tried that, computation time went up of course, but surprizingly the final deflated result was slightly _larger_ as well, probably due to the fact that zlib was less efficient with the increased randomness in the tighter delta output to deflate.

Nicolas
Previous: Jakub NarebskiNext: Albretch Mueller
Message 7 of 8 in “diff'ing files ...”
  1. Albretch MuellerJun 6, 2011
  2. Jeff KingJun 6, 2011
  3. Albretch MuellerJun 7, 2011
  4. Jeff KingJun 7, 2011
  5. Nicolas PitreJun 10, 2011
  6. Jakub NarebskiJun 10, 2011
  7. Nicolas PitreJun 10, 2011
  8. Albretch MuellerJun 12, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.