Mercurial > hg
changeset 40558:4756a33d0d31
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.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 05 Nov 2018 15:57:31 +0100 |
parents | 355ae096faef |
children | 26bab5c03e4c |
files | contrib/perf.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Mon Nov 05 15:24:09 2018 +0100 +++ b/contrib/perf.py Mon Nov 05 15:57:31 2018 +0100 @@ -1573,6 +1573,7 @@ (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 @@ 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 @@ 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 @@ 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'