size of repository with many branches, vs. git

Adrian Buehlmann adrian at cadifra.com
Sun Mar 30 17:10:35 CDT 2008


On 30.03.2008 23:04, Matt Mackall wrote:
> Here's a quick test to see what we might stand to gain from non-linear
> deltas on your repo:
> 
> -----
> #!/usr/bin/python
> 
> import sys
> from mercurial import revlog
> 
> r = revlog.revlog(open, sys.argv[1])
> frags = []
> total = 0
> optimized = 0
> 
> for i in range(r.count()):
>     n = r.node(i)
>     c = r.length(i)
>     total += c
>     o = [c]
>     for p in r.parentrevs(i):
>         if p != -1:
>             d = revlog.compress(r.revdiff(p, i))
>             o.append(len(d[0]) + len(d[1]))
>     optimized += min(o)
>     if not i % 1000:
>         print i, total, optimized, "%5.2f" % (100.0 * optimized/total)
> 
> print i, total, optimized, "%5.2f" % (100.0 * optimized/total)
> -----
> 
> Just run "python revlogstat .hg/store/00manifest.i"
> 
> On Mercurial itself, we get:
> 0 453 453 100.00
> 1000 185808 131249 70.64
> 2000 415933 244696 58.83
> 3000 744285 367411 49.36
> 4000 1022945 490668 47.97
> 5000 1710896 614376 35.91
> 6000 2355557 741334 31.47
> 6388 2617967 799271 30.53
> 
> ie we save nearly 70% of the manifest size. This is only an
> approximation, because it doesn't include insertion of full revisions at
> intervals to keep extraction time bounded.
> 

Probably off topic, but:

I get a traceback on WinXP using 407dcc0c1429 (or 1.0):

> python revlogstat.py .hg/store/00manifest.i
0 453 453 100.00
Traceback (most recent call last):
  File "revlogstat.py", line 18, in <module>
    d = revlog.compress(r.revdiff(p, i))
  File "C:\Documents and Settings\adi\My Documents\hg-repos\mercurial-crew\mercurial\revlog.py", line 914, in revdiff
    return self.chunk(rev2)
  File "C:\Documents and Settings\adi\My Documents\hg-repos\mercurial-crew\mercurial\revlog.py", line 904, in chunk
    return decompress(c)
  File "C:\Documents and Settings\adi\My Documents\hg-repos\mercurial-crew\mercurial\revlog.py", line 102, in decompress
    return _decompress(bin)
zlib.error: Error -5 while decompressing data

> python -V
Python 2.5.1


More information about the Mercurial mailing list