# Re: [BUG?] gc and impatience

3 messages from 2013-08-05 to 2013-08-06. Participants: Ramkumar Ramachandra, Martin Fick.
Thread: https://gitlist.dev/t/34615

## Ramkumar Ramachandra, 2013-08-05 17:34

Subject: Re: [BUG?] gc and impatience
Message-ID: <CALkWK0=djXdPMOvk8359nOs=rGLbBepxyXnpELfWs+wjjN7YZw@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0%3DdjXdPMOvk8359nOs%3DrGLbBepxyXnpELfWs%2BwjjN7YZw%40mail.gmail.com
In-Reply-To: <1rpxs5pa827iefbyduyodlc7.1375495435629@email.android.com>

```
Martin Fick wrote:
> https://gerrit-review.googlesource.com/#/c/35215/

Very cool. Of what I understood:

So, the problem is that my .git/objects/pack is polluted with little
packs everytime I fetch (or push, if you're the server), and this is
problematic from the perspective of a overtly (naively) aggressive gc
that hammers out all fragmentation.  So, on the first run, the little
packfiles I have are all "consolidated" into big packfiles; you also
write .keep files to say that "don't gc these big packs we just
generated".  In subsequent runs, the little packfiles from the fetch
are absorbed into a pack that is immune to gc.  You're also using a
size heuristic, to consolidate similarly sized packfiles.  You also
have a --ratio to tweak the ratio of sizes.

I've checked it in and started using it; so yeah: I'll chew on it for
a few weeks.

Thanks.

```

## Martin Fick, 2013-08-05 18:45

Subject: Re: [BUG?] gc and impatience
Message-ID: <201308051245.07995.mfick@codeaurora.org>
URL: https://gitlist.dev/e/201308051245.07995.mfick%40codeaurora.org
In-Reply-To: <CALkWK0=djXdPMOvk8359nOs=rGLbBepxyXnpELfWs+wjjN7YZw@mail.gmail.com>

```
On Monday, August 05, 2013 11:34:24 am Ramkumar Ramachandra 
wrote:
> Martin Fick wrote:
> > https://gerrit-review.googlesource.com/#/c/35215/
> 
> Very cool. Of what I understood:
> 
> So, the problem is that my .git/objects/pack is polluted
> with little packs everytime I fetch (or push, if you're
> the server), and this is problematic from the
> perspective of a overtly (naively) aggressive gc that
> hammers out all fragmentation.  So, on the first run,
> the little packfiles I have are all "consolidated" into
> big packfiles; you also write .keep files to say that
> "don't gc these big packs we just generated".  In
> subsequent runs, the little packfiles from the fetch are
> absorbed into a pack that is immune to gc.  You're also
> using a size heuristic, to consolidate similarly sized
> packfiles.  You also have a --ratio to tweak the ratio
> of sizes.

Yes, pretty much.  

I suspect that a smarter implementation would do a "less 
good job of packing" to save time also.  I think this can be 
done by further limiting much of the lookups to the packs 
being packed (or some limited set of the greater packfiles).  
I admit I don't really understand how much the packing does 
today, but I believe it still looks at the larger packs with 
keeps to potentially deltafy against them, or to determine 
which objects are duplicated and thus should not be put into 
the new smaller packfiles?  I say this because the time 
savings of this script is not as significant as I would have 
expected it to be (but the IO is).  I think that it is 
possible to design a git gc using this rolling approach that 
would actually greatly reduce the time spent packing also.  
However, I don't think that can easily be done in a script 
like mine which just wraps itself around git gc.  I hope 
that someone more familiar with git gc than me might take 
this on some day. :)


> I've checked it in and started using it; so yeah: I'll
> chew on it for a few weeks.

The script also does some nasty timestamp manipulations that 
I am not proud of.  They had significant time impacts for 
us, and likely could have been achieved some other way.  
They shouldn't be relevant to the packing algo though.  I 
hope it doesn't interfere with the evaluation of the 
approach.

Thanks for taking an interest in it,

-Martin

-- 
The Qualcomm Innovation Center, Inc. is a member of Code 
Aurora Forum, hosted by The Linux Foundation
 

```

## Ramkumar Ramachandra, 2013-08-06 02:59

Subject: Re: [BUG?] gc and impatience
Message-ID: <CALkWK0krAnVOx5c5-TT_k5NDfKm+cEft+xQUDSq+TLDm1r6-5Q@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0krAnVOx5c5-TT_k5NDfKm%2BcEft%2BxQUDSq%2BTLDm1r6-5Q%40mail.gmail.com
In-Reply-To: <201308051245.07995.mfick@codeaurora.org>

```
Martin Fick wrote:
> I hope
> that someone more familiar with git gc than me might take
> this on some day. :)

More likely scenario: someone who is unfamiliar with it will read and
patch it little by little :)

```
