From patchwork Tue Nov 6 10:34:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,3] perf: measure slicing time in perfrevlogrevision From: Boris Feld X-Patchwork-Id: 36411 Message-Id: <71b1cbf7a7b59d06972b.1541500463@Laptop-Boris.lan> To: mercurial-devel@mercurial-scm.org Date: Tue, 06 Nov 2018 11:34:23 +0100 # HG changeset patch # User Boris Feld # Date 1541498713 -3600 # Tue Nov 06 11:05:13 2018 +0100 # Node ID 71b1cbf7a7b59d06972b18c9f3cab27019b2cb0e # Parent 59d548edb4ce2dafb989ffc2d0a95fb4bb19d2ee # EXP-Topic sparse-prefrevlogrevision # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 71b1cbf7a7b5 perf: measure slicing time in perfrevlogrevision Slicing a sparse delta chain can be expensive. We now benchmark the associated time. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1692,10 +1692,11 @@ def perfrevlogrevision(ui, repo, file_, 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 applicatble + 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 @@ def perfrevlogrevision(ui, repo, file_, 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() @@ -1797,11 +1802,18 @@ def perfrevlogrevision(ui, repo, file_, (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: