##// END OF EJS Templates
perfrevflogwrite: clear revlog cache between each write...
Boris Feld -
r41013:21a9cace default
parent child Browse files
Show More
@@ -1722,6 +1722,7 b' def perfrevlogrevisions(ui, repo, file_='
1722 (b'', b'details', False, b'print timing for every revisions tested'),
1722 (b'', b'details', False, b'print timing for every revisions tested'),
1723 (b'', b'source', b'full', b'the kind of data feed in the revlog'),
1723 (b'', b'source', b'full', b'the kind of data feed in the revlog'),
1724 (b'', b'lazydeltabase', True, b'try the provided delta first'),
1724 (b'', b'lazydeltabase', True, b'try the provided delta first'),
1725 (b'', b'clear-caches', True, b'clear revlog cache between calls'),
1725 ],
1726 ],
1726 b'-c|-m|FILE')
1727 b'-c|-m|FILE')
1727 def perfrevlogwrite(ui, repo, file_=None, startrev=1000, stoprev=-1, **opts):
1728 def perfrevlogwrite(ui, repo, file_=None, startrev=1000, stoprev=-1, **opts):
@@ -1746,6 +1747,7 b' def perfrevlogwrite(ui, repo, file_=None'
1746
1747
1747 lazydeltabase = opts['lazydeltabase']
1748 lazydeltabase = opts['lazydeltabase']
1748 source = opts['source']
1749 source = opts['source']
1750 clearcaches = opts['clear_cache']
1749 validsource = (b'full', b'parent-1', b'parent-2', b'parent-smallest',
1751 validsource = (b'full', b'parent-1', b'parent-2', b'parent-smallest',
1750 b'storage')
1752 b'storage')
1751 if source not in validsource:
1753 if source not in validsource:
@@ -1758,7 +1760,8 b' def perfrevlogwrite(ui, repo, file_=None'
1758 allresults = []
1760 allresults = []
1759 for c in range(count):
1761 for c in range(count):
1760 timing = _timeonewrite(ui, rl, source, startrev, stoprev, c + 1,
1762 timing = _timeonewrite(ui, rl, source, startrev, stoprev, c + 1,
1761 lazydeltabase=lazydeltabase)
1763 lazydeltabase=lazydeltabase,
1764 clearcaches=clearcaches)
1762 allresults.append(timing)
1765 allresults.append(timing)
1763
1766
1764 ### consolidate the results in a single list
1767 ### consolidate the results in a single list
@@ -1825,7 +1828,7 b' class _faketr(object):'
1825 return None
1828 return None
1826
1829
1827 def _timeonewrite(ui, orig, source, startrev, stoprev, runidx=None,
1830 def _timeonewrite(ui, orig, source, startrev, stoprev, runidx=None,
1828 lazydeltabase=True):
1831 lazydeltabase=True, clearcaches=True):
1829 timings = []
1832 timings = []
1830 tr = _faketr()
1833 tr = _faketr()
1831 with _temprevlog(ui, orig, startrev) as dest:
1834 with _temprevlog(ui, orig, startrev) as dest:
@@ -1838,6 +1841,9 b' def _timeonewrite(ui, orig, source, star'
1838 for idx, rev in enumerate(revs):
1841 for idx, rev in enumerate(revs):
1839 ui.progress(topic, idx, unit='revs', total=total)
1842 ui.progress(topic, idx, unit='revs', total=total)
1840 addargs, addkwargs = _getrevisionseed(orig, rev, tr, source)
1843 addargs, addkwargs = _getrevisionseed(orig, rev, tr, source)
1844 if clearcaches:
1845 dest.index.clearcaches()
1846 dest.clearcaches()
1841 with timeone() as r:
1847 with timeone() as r:
1842 dest.addrawrevision(*addargs, **addkwargs)
1848 dest.addrawrevision(*addargs, **addkwargs)
1843 timings.append((rev, r[0]))
1849 timings.append((rev, r[0]))
General Comments 0
You need to be logged in to leave comments. Login now