garbage collection - Understanding git gc --auto -
i'm experimenting aggressive auto gc in git, packing purposes. in repos if git config --list
have setup
... gc.auto=250 gc.autopacklimit=30 ...
if git count-objects -v
get
count: 376 size: 1251 in-pack: 2776 packs: 1 size-pack: 2697 prune-packable: 0 garbage: 0
but git gc --auto
doesn't change these figures, nothing being packed! shouldn't loose objects packed since i'm 126 objects on gc.auto limit?
one of main points of gc --auto
should quick, other commands can call “just in case”. achieve that, object count guessed. git config
says under gc.auto
:
when there approximately more many loose objects in repository […]
looking @ code (too_many_loose_objects()
in buildin/gc.c
), here’s happens:
- the gc.auto divided 256 , rounded up
- the folder contains objects start
17
opened - it checked if folder contains more objects result of step 1
this works fine, since sha-1 evenly distributed, “all objects start x” representative whole set. of course works big big amount of objects. lazy maths, guess @ least >3000. 6700 (the default value of gc.auto
), should work quite reliably.
the core question me why need such low setting , whether important runs @ 250 objects. setting of 250, gc
run have 2 loose objects start 17
. chance happens > 80%
600 objects , > 90%
800 objects.
update: couldn’t – had math :). wondering how estimation system work. here’s plot of results. given gc.auto
, how high probability gc
start when there gc.auto
(red) / gc.auto * 1.1
(green) / gc.auto * 1.2
(orange) / gc.auto * 1.5
(blue) / gc.auto * 2
(purple) loose objects in repo?
Comments
Post a Comment