Mercurial > hg-stable
changeset 40990:21a9cace4bbf
perfrevflogwrite: clear revlog cache between each write
We want to measure write time from a cold cache (similar to commit). So we
need to clear the cache to prevent computation from rev N-1 to interfere with
rev N.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 17 Dec 2018 10:37:22 +0100 |
parents | ef7119cd4965 |
children | 42f59d3f714d |
files | contrib/perf.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Sun Dec 16 17:42:45 2018 -0500 +++ b/contrib/perf.py Mon Dec 17 10:37:22 2018 +0100 @@ -1722,6 +1722,7 @@ (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'', b'clear-caches', True, b'clear revlog cache between calls'), ], b'-c|-m|FILE') def perfrevlogwrite(ui, repo, file_=None, startrev=1000, stoprev=-1, **opts): @@ -1746,6 +1747,7 @@ lazydeltabase = opts['lazydeltabase'] source = opts['source'] + clearcaches = opts['clear_cache'] validsource = (b'full', b'parent-1', b'parent-2', b'parent-smallest', b'storage') if source not in validsource: @@ -1758,7 +1760,8 @@ allresults = [] for c in range(count): timing = _timeonewrite(ui, rl, source, startrev, stoprev, c + 1, - lazydeltabase=lazydeltabase) + lazydeltabase=lazydeltabase, + clearcaches=clearcaches) allresults.append(timing) ### consolidate the results in a single list @@ -1825,7 +1828,7 @@ return None def _timeonewrite(ui, orig, source, startrev, stoprev, runidx=None, - lazydeltabase=True): + lazydeltabase=True, clearcaches=True): timings = [] tr = _faketr() with _temprevlog(ui, orig, startrev) as dest: @@ -1838,6 +1841,9 @@ for idx, rev in enumerate(revs): ui.progress(topic, idx, unit='revs', total=total) addargs, addkwargs = _getrevisionseed(orig, rev, tr, source) + if clearcaches: + dest.index.clearcaches() + dest.clearcaches() with timeone() as r: dest.addrawrevision(*addargs, **addkwargs) timings.append((rev, r[0]))