Re: [PATCH 2/2] rev-list: add --disk-usage option for calculating disk usage
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jan 27, 2021, 23:07 UTC
- Message-ID
- <CAPig+cQTV6ACiOj+GKoBwj15TZBr5craVPT6dYzzSDfrX9a3YA@mail.gmail.com>
- In-Reply-To
- <YBHmY7vNxu2hqOa/@coredump.intra.peff.net>
On Wed, Jan 27, 2021 at 5:20 PM Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> This patch implements a --disk-usage option which produces the same
> answer in a fraction of the time. Here are some timings using a clone of
> torvalds/linux:
>
> [rev-list piped to cat-file, no bitmaps]
> $ time git rev-list --objects --all |
> cut -d' ' -f1 |
> git cat-file --buffer --batch-check='%(objectsize:disk)' |
> perl -lne '$total += $_; END { print $total }'
> 1455691059
> real 0m34.336s
> user 0m46.533s
> sys 0m2.953sThis example shows the computed size (1455691059)...
Show 10 quoted lines
> But the real win is with bitmaps. If we use them without the new option:
>
> [rev-list piped to cat-file, bitmaps]
> $ time git rev-list --objects --all --use-bitmap-index |
> cut -d' ' -f1 |
> git cat-file --batch-check='%(objectsize:disk)' |
> perl -lne '$total += $_; END { print $total }'
> real 0m9.954s
> user 0m11.234s
> sys 0m8.522s...however, this example does not (but all the others do). Simple copy/paste error?
Not worth a re-roll, of course.