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

Re: GSoC - Some questions on the idea of

From
Jeff King <peff@peff.net>
Date
Apr 11, 2012, 21:35 UTC
Message-ID
<20120411213522.GA28199@sigill.intra.peff.net>
In-Reply-To
<4F84DD60.20903@gmail.com>
On Tue, Apr 10, 2012 at 08:24:48PM -0500, Neal Kreitzinger wrote:
> (I read bup DESIGN doc to see what bup-style splitting is.) When you
> use bup delta technology in git.git I take it that you will use it
> for big-worktree-files *and* big-history-files

I'm not sure what those terms mean. We are talking about files at the blob level. So they are either big or not big. We don't know how they will delta, or what their histories will be like.

> (not-big-worktree-files that are not xdelta delta-friendly)?
> IOW, all binaries plus big-text-worktree-files.  Otherwise, small
> binaries will become large histories.

Files that don't delta won't be helped by splitting, as it is just another form of finding deltas (in fact, it should produce worse results than xdelta, because it works with larger granularity; its advantage is that it is not as memory or CPU-hungry as something like xdelta).

So you really only want to use this for files that are too big to practically run through the regular delta algorithm. And if you can avoid it on files that will never delta well, you are better off (because it adds storage overhead over a straight blob).

The first part is easy: only do it for files that are so big that you can't run the regular delta algorithm. So since your only alternative is doing nothing, you only have to perform better than nothing. :)

The second part is harder. We generally don't know that a file doesn't delta well until we have two versions of it to try[1]. And that's where some domain-specific knowledge can come in (e.g., knowing that a file is compressed video, and that future versions are likely to differ in the video content). But sometimes the results can be surprising. I keep a repository of photos and videos, carefully annotated via exif tags. If the media content changes, the results won't delta well. But if I change the exif tags, they _do_ delta very well. So whether something like bupsplit is a win depends on the exact update patterns.

[1] I wonder if you could do some statistical analysis on the randomness
    of the file content to determine this. That is, things which look
    very random are probably already heavily compressed, and are not
    going to compress further. You might guess that to mean that they
    will not delta well, either. And sometimes that is true. But the
    example I gave above violates it (most of the file is random, but
    the _changes_ from version to version will not be random, and that
    is what the delta is compressing).
Show 5 quoted lines
> If small binaries are not going to be bup-delta-compressed, then what
> about using xxd to convert the binary to text and then xdelta
> compressing the hex dump to achieve efficient delta compression in
> the pack file?  You could convert the hexdump back to binary with xxd
> for checkout and such.

That wouldn't help. You are only trading the binary representation for a less efficient one. But the data patterns will not change. The redundancy you introduced in the first step may mostly come out via compression, but it will never be a net win. I'm sure if I were a better computer scientist I could write you some proof involving Shannon entropy. But here's a fun experiment:

  # create two files, one very compressible and one not very
  # compressible
  dd if=/dev/zero of=boring.bin bs=1M count=1
  dd if=/dev/urandom of=rand.bin bs=1M count=1
  # now make hex dumps of each, and compress the original and the hex
  # dump
  for i in boring rand; do
    xxd <$i.bin >$i.hex
    for j in bin hex; do
      gzip -c <$i.$j >$i.$j.gz
    done
  done
  # and look at the results
  du {boring,rand}.*
I get:
  1024    boring.bin
  4       boring.bin.gz
  4288    boring.hex
  188     boring.hex.gz
  1024    rand.bin
  1028    rand.bin.gz
  4288    rand.hex
  2324    rand.hex.gz

So you can see that the thing that compresses well will do so in either representation, but the end result is a net loss with the less efficient representation. Whereas the thing that does not compress well will achieve a better compression ratio in its text form, but will still be a net loss. The reason is that you are just compressing out all of the redundant bits.

You might observe that this is using gzip, not xdelta. But I think from an information theory standpoint, they are two sides of the same coin (e.g., you could consider a delta between two things to be equivalent to concatenating them and compressing the result). You should be able to design a similar experiment with xdelta.

> Maybe small binaries do xdelta well and the above is a moot point.

Some will and some will not. But it has nothing to do with whether they are binary, and everything to do with the type of content they store (or if binariness does matter, then our delta algorithms should be improved).

Show 9 quoted lines
> This is all theory to me, but the reality is looming over my head
> since most of the components I should be tracking are binaries small
> (large history?) and big (but am not yet because of "big-file"
> concerns -- I don't want to have to refactor my vast git ecosystem
> with filter branch later because I slammed binaries into the main
> project or superproject without proper systems programming (I'm not
> sure what the c/linux term is for 'systems programming', but in the
> mainframe world it meant making sure everything was configured for
> efficient performance)).

One of the things that makes bup not usable as-is for git is that it fundamentally changes the object identities. It would be very easy for "git add" to bupsplit a file into a tree, and store that tree using git (in fact, that is more or less how bup works). But that means that the resulting object sha1 is going to depend on the splitting choices made. Instead, we want to consider the split version of an object to be simply an on-disk representation detail. Just as it is a representation detail that some objects are stored in delta-encoding inside packs, versus as loose objects; the sha1 of the object is the same, and we can reconstruct it byte-for-byte when we want to.

So properly implemented, no, you would not have to ever filter-branch to tweak these settings. You might have to do a repack to see the gains (because you want to delete the old non-split representation you have in your pack and replace it with a split representation), but that is transparent to git's abstract data model.

-Peff
Previous: Neal KreitzingerNext: Neal Kreitzinger
Message 22 of 43 in “GSoC - Some questions on the idea of "Better big-file support".”
  1. Bo ChenMar 28, 2012
  2. Nguyen Thai Ngoc DuyMar 28, 2012
  3. SergioMar 28, 2012
  4. Bo ChenMar 30, 2012
  5. Bo ChenMar 30, 2012
  6. Jeff KingMar 30, 2012
  7. Bo ChenMar 30, 2012
  8. Sergio CallegariMar 31, 2012
  9. Neal KreitzingerMar 31, 2012
  10. Jeff KingApr 2, 2012
  11. Sergio CallegariApr 3, 2012
  12. Neal KreitzingerApr 11, 2012
  13. Jonathan NiederApr 11, 2012
  14. Neal KreitzingerApr 11, 2012
  15. Jeff KingApr 11, 2012
  16. Neal KreitzingerApr 11, 2012
  17. Neal KreitzingerApr 11, 2012
  18. Jonathan NiederApr 11, 2012
  19. Junio C HamanoApr 11, 2012
  20. Jonathan NiederApr 11, 2012
  21. Neal KreitzingerApr 11, 2012
  22. Jeff KingApr 11, 2012
  23. Neal KreitzingerApr 12, 2012
  24. Jeff KingApr 12, 2012
  25. Neal KreitzingerApr 12, 2012
  26. Bo ChenApr 13, 2012
  27. Neal KreitzingerMar 31, 2012
  28. Jeff KingApr 2, 2012
  29. Junio C HamanoApr 2, 2012
  30. Jeff KingApr 3, 2012
  31. Neal KreitzingerMar 31, 2012
  32. Neal KreitzingerMar 31, 2012
  33. Bo ChenMar 31, 2012
  34. Nguyen Thai Ngoc DuyApr 1, 2012
  35. Bo ChenApr 1, 2012
  36. Nguyen Thai Ngoc DuyApr 2, 2012
  37. Bo ChenMar 30, 2012
  38. Jeff KingMar 30, 2012
  39. Jeff KingApr 15, 2012
  40. Neal KreitzingerApr 15, 2012
  41. Jeff KingApr 16, 2012
  42. Neal KreitzingerMay 10, 2012
  43. Jeff KingMay 10, 2012

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.