##// END OF EJS Templates
perf: teach perfrevlogrevision about sparse reading...
Boris Feld -
r40566:914079ee default
parent child Browse files
Show More
@@ -1723,17 +1723,18 def perfrevlogrevision(ui, repo, file_,
1723 1723 inline = r._inline
1724 1724 iosize = r._io.size
1725 1725 buffer = util.buffer
1726 offset = start(chain[0])
1727 1726
1728 1727 chunks = []
1729 1728 ladd = chunks.append
1730
1731 for rev in chain:
1729 for idx, item in enumerate(chain):
1730 offset = start(item[0])
1731 bits = data[idx]
1732 for rev in item:
1732 1733 chunkstart = start(rev)
1733 1734 if inline:
1734 1735 chunkstart += (rev + 1) * iosize
1735 1736 chunklength = length(rev)
1736 ladd(buffer(data, chunkstart - offset, chunklength))
1737 ladd(buffer(bits, chunkstart - offset, chunklength))
1737 1738
1738 1739 return chunks
1739 1740
@@ -1745,7 +1746,8 def perfrevlogrevision(ui, repo, file_,
1745 1746 def doread(chain):
1746 1747 if not cache:
1747 1748 r.clearcaches()
1748 segmentforrevs(chain[0], chain[-1])
1749 for item in slicedchain:
1750 segmentforrevs(item[0], item[-1])
1749 1751
1750 1752 def dorawchunks(data, chain):
1751 1753 if not cache:
@@ -1772,9 +1774,19 def perfrevlogrevision(ui, repo, file_,
1772 1774 r.clearcaches()
1773 1775 r.revision(node)
1774 1776
1777 try:
1778 from mercurial.revlogutils.deltas import slicechunk
1779 except ImportError:
1780 slicechunk = getattr(revlog, '_slicechunk', None)
1781
1782 size = r.length(rev)
1775 1783 chain = r._deltachain(rev)[0]
1776 data = segmentforrevs(chain[0], chain[-1])[1]
1777 rawchunks = getrawchunks(data, chain)
1784 if not getattr(r, '_withsparseread', False):
1785 slicedchain = (chain,)
1786 else:
1787 slicedchain = tuple(slicechunk(r, chain, targetsize=size))
1788 data = [segmentforrevs(seg[0], seg[-1])[1] for seg in slicedchain]
1789 rawchunks = getrawchunks(data, slicedchain)
1778 1790 bins = r._chunks(chain)
1779 1791 text = bytes(bins[0])
1780 1792 bins = bins[1:]
@@ -1784,7 +1796,7 def perfrevlogrevision(ui, repo, file_,
1784 1796 (lambda: dorevision(), b'full'),
1785 1797 (lambda: dodeltachain(rev), b'deltachain'),
1786 1798 (lambda: doread(chain), b'read'),
1787 (lambda: dorawchunks(data, chain), b'rawchunks'),
1799 (lambda: dorawchunks(data, slicedchain), b'rawchunks'),
1788 1800 (lambda: dodecompress(rawchunks), b'decompress'),
1789 1801 (lambda: dopatch(text, bins), b'patch'),
1790 1802 (lambda: dohash(text), b'hash'),
General Comments 0
You need to be logged in to leave comments. Login now