Mercurial > hg-stable
changeset 40748:39d29542fe40
sparse-revlog: put the native implementation of slicechunktodensity to use
When possible, the C implementation of delta chain slicing will be used.
providing a large boost in performance for this operation.
To take a practical example of restoring manifest revision '59547c40bc4c' for
a reference NetBeans repository (using sparse-revlog). The media time of the
step `slice-sparse-chain` of `perfrevlogrevision` improve from 0.660 ms to
0.098 ms;
The full series move delta chain slicing from 1.120 ms to 0.098 ms;
Implementing _slicechunktosize into C would yield further improvements.
However, the performance seems good enough for now.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 15 Nov 2018 11:11:38 +0100 |
parents | f2342483f7a6 |
children | 50a64c321c1e |
files | mercurial/revlogutils/deltas.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py Thu Nov 15 11:10:52 2018 +0100 +++ b/mercurial/revlogutils/deltas.py Thu Nov 15 11:11:38 2018 +0100 @@ -44,6 +44,7 @@ self._srdensitythreshold = density self._srmingapsize = mingap self._snapshot = set(snapshot) + self.index = None def start(self, rev): if rev == 0: @@ -120,9 +121,12 @@ targetsize = max(targetsize, revlog._srmingapsize) # targetsize should not be specified when evaluating delta candidates: # * targetsize is used to ensure we stay within specification when reading, - for chunk in _slicechunktodensity(revlog, revs, - revlog._srdensitythreshold, - revlog._srmingapsize): + densityslicing = getattr(revlog.index, 'slicechunktodensity', None) + if densityslicing is None: + densityslicing = lambda x, y, z: _slicechunktodensity(revlog, x, y, z) + for chunk in densityslicing(revs, + revlog._srdensitythreshold, + revlog._srmingapsize): for subchunk in _slicechunktosize(revlog, chunk, targetsize): yield subchunk