# HG changeset patch # User Boris Feld # Date 1541498713 -3600 # Node ID e6c8a0fd3db4a379abe42ae56085ced56338ddd9 # Parent 914079ee3334fa550042622d701159253aff4301 perf: measure slicing time in perfrevlogrevision Slicing a sparse delta chain can be expensive. We now benchmark the associated time. diff -r 914079ee3334 -r e6c8a0fd3db4 contrib/perf.py --- a/contrib/perf.py Tue Nov 06 11:04:23 2018 +0100 +++ b/contrib/perf.py Tue Nov 06 11:05:13 2018 +0100 @@ -1692,10 +1692,11 @@ Obtaining a revlog revision consists of roughly the following steps: 1. Compute the delta chain - 2. Obtain the raw chunks for that delta chain - 3. Decompress each raw chunk - 4. Apply binary patches to obtain fulltext - 5. Verify hash of fulltext + 2. Slice the delta chain if applicable + 3. Obtain the raw chunks for that delta chain + 4. Decompress each raw chunk + 5. Apply binary patches to obtain fulltext + 6. Verify hash of fulltext This command measures the time spent in each of these phases. """ @@ -1749,6 +1750,10 @@ for item in slicedchain: segmentforrevs(item[0], item[-1]) + def doslice(r, chain, size): + for s in slicechunk(r, chain, targetsize=size): + pass + def dorawchunks(data, chain): if not cache: r.clearcaches() @@ -1796,11 +1801,18 @@ (lambda: dorevision(), b'full'), (lambda: dodeltachain(rev), b'deltachain'), (lambda: doread(chain), b'read'), + ] + + if getattr(r, '_withsparseread', False): + slicing = (lambda: doslice(r, chain, size), b'slice-sparse-chain') + benches.append(slicing) + + benches.extend([ (lambda: dorawchunks(data, slicedchain), b'rawchunks'), (lambda: dodecompress(rawchunks), b'decompress'), (lambda: dopatch(text, bins), b'patch'), (lambda: dohash(text), b'hash'), - ] + ]) timer, fm = gettimer(ui, opts) for fn, title in benches: