Thread (34 messages) flat view 34 messages, 6 authors, 2016-06-15

Re: GSoC - Some questions on the idea of

From: Jeff King <hidden>
Date: 2016-06-15 22:53:33

On Wed, Apr 11, 2012 at 11:29:50AM -0500, Neal Kreitzinger wrote:
How do I check the history size of a binary?  IOW, how to I check the
size of the sum of all the delta-compressions and root blob of a binary?
 That way I can sample different binary types to get a symptomatic idea
of how well they are delta compressing.  I suspect that compiled
binaries will compress well (efficient history) and graphics files may
not compress well (large history).
I don't think there is a simple command to do it. You have to correlate
blobs at a given path with objects in the packs yourself. You can script
it like:

  # get the delta stats from every pack; you only need to do this part
  # once for a given history state. And obviously you would want to
  # repack before doing it.
  for i in .git/objects/pack/*.pack; do
    git verify-pack -v $i;
  done |
  perl -lne '
    # format is: sha1 type size size-in-pack offset; pick out only the
    # thing we care about: size in pack
    /^([0-9a-f]{40}) \S+\s+\d+ (\d+)/ and print "$1 $2";
  ' |
  sort >delta-stats


  # then you can do this for every path you are interested in.

  # First, get the list of blobs at that path (and follow renames, too).
  # The second line is picking the "after" sha1 from the --raw output.
  git log --follow --raw --no-abbrev $path |
  perl -lne '/:\S+ \S+ \S{40} (\S{40})/ and print $1' |
  sort -u >blobs

  # Then find the delta stats for those blobs
  join blobs delta-stats

which should give you the stored size of each version of a file.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help