Patchwork [9,of,9,V3] perf: add a lazydeltabase option to perfrevlogwrite

login
register
mail settings
Submitter Boris Feld
Date Nov. 6, 2018, 11:27 a.m.
Message ID <38a806e71d59917d4af6.1541503657@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/36423/
State Accepted
Headers show

Comments

Boris Feld - Nov. 6, 2018, 11:27 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1541429851 -3600
#      Mon Nov 05 15:57:31 2018 +0100
# Node ID 38a806e71d59917d4af67d159368ed75d3939fdd
# Parent  d3de1f9690311ba4558a19fd70bcd88e74ffd60b
# EXP-Topic revlog-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 38a806e71d59
perf: add a lazydeltabase option to perfrevlogwrite

The option controls if we'll test the provided delta first. This is the current
default behavior for unbundle.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1573,6 +1573,7 @@  def perfrevlogrevisions(ui, repo, file_=
           (b'', b'count', 3, b'last revision to write'),
           (b'', b'details', False, b'print timing for every revisions tested'),
           (b'', b'source', b'full', b'the kind of data feed in the revlog'),
+          (b'', b'lazydeltabase', True, b'try the provided delta first'),
          ],
          b'-c|-m|FILE')
 def perfrevlogwrite(ui, repo, file_=None, startrev=1000, stoprev=-1, **opts):
@@ -1595,6 +1596,7 @@  def perfrevlogwrite(ui, repo, file_=None
     if stoprev < 0:
         stoprev = rllen + stoprev
 
+    lazydeltabase = opts['lazydeltabase']
     source = opts['source']
     validsource = (b'full', b'parent-1', b'parent-2', b'parent-smallest',
                    b'storage')
@@ -1607,7 +1609,8 @@  def perfrevlogwrite(ui, repo, file_=None
         raise error.Abort('invalide run count: %d' % count)
     allresults = []
     for c in range(count):
-        timing = _timeonewrite(ui, rl, source, startrev, stoprev, c + 1)
+        timing = _timeonewrite(ui, rl, source, startrev, stoprev, c + 1,
+                               lazydeltabase=lazydeltabase)
         allresults.append(timing)
 
     ### consolidate the results in a single list
@@ -1670,10 +1673,12 @@  class _faketr(object):
     def add(s, x, y, z=None):
         return None
 
-def _timeonewrite(ui, orig, source, startrev, stoprev, runidx=None):
+def _timeonewrite(ui, orig, source, startrev, stoprev, runidx=None,
+                  lazydeltabase=True):
     timings = []
     tr = _faketr()
     with _temprevlog(ui, orig, startrev) as dest:
+        dest._lazydeltabase = lazydeltabase
         revs = list(orig.revs(startrev, stoprev))
         total = len(revs)
         topic = 'adding'