# HG changeset patch # User Paul Morelle # Date 2017-10-18 07:07:48 # Node ID 8c9b08a0c48c686633e6a1bd3418d718bf14bd73 # Parent 9e18ab7f7240d768e708ba10b51e7df5864e88b8 sparse-read: skip gaps too small to be worth splitting Splitting at too small gaps might not be worthwhile. With this changeset, we stop considering splitting on too small gaps. The threshold is configurable. We arbitrarily pick 256K as a default value because it seems "okay". Further testing on various repositories and setups will be needed to tune it. The option name is 'experimental.sparse-read.min-gap-size`, and replaces `experimental.sparse-read.min-block-size` which is not used any more. diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -444,7 +444,7 @@ coreconfigitem('experimental', 'sparse-r coreconfigitem('experimental', 'sparse-read.density-threshold', default=0.25, ) -coreconfigitem('experimental', 'sparse-read.min-block-size', +coreconfigitem('experimental', 'sparse-read.min-gap-size', default='256K', ) coreconfigitem('experimental', 'treemanifest', diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -611,11 +611,11 @@ class localrepository(object): withsparseread = self.ui.configbool('experimental', 'sparse-read') srdensitythres = float(self.ui.config('experimental', 'sparse-read.density-threshold')) - srminblocksize = self.ui.configbytes('experimental', - 'sparse-read.min-block-size') + srmingapsize = self.ui.configbytes('experimental', + 'sparse-read.min-gap-size') self.svfs.options['with-sparse-read'] = withsparseread self.svfs.options['sparse-read-density-threshold'] = srdensitythres - self.svfs.options['sparse-read-min-block-size'] = srminblocksize + self.svfs.options['sparse-read-min-gap-size'] = srmingapsize for r in self.requirements: if r.startswith('exp-compression-'): diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -196,7 +196,8 @@ def _slicechunk(revlog, revs): if prevend is not None: gapsize = revstart - prevend - if gapsize: + # only consider holes that are large enough + if gapsize > revlog._srmingapsize: heapq.heappush(gapsheap, (-gapsize, i)) prevend = revstart + revlen @@ -371,7 +372,7 @@ class revlog(object): self._maxdeltachainspan = -1 self._withsparseread = False self._srdensitythreshold = 0.25 - self._srminblocksize = 262144 + self._srmingapsize = 262144 mmapindexthreshold = None v = REVLOG_DEFAULT_VERSION @@ -401,8 +402,8 @@ class revlog(object): self._withsparseread = bool(opts.get('with-sparse-read', False)) if 'sparse-read-density-threshold' in opts: self._srdensitythreshold = opts['sparse-read-density-threshold'] - if 'sparse-read-min-block-size' in opts: - self._srminblocksize = opts['sparse-read-min-block-size'] + if 'sparse-read-min-gap-size' in opts: + self._srmingapsize = opts['sparse-read-min-gap-size'] if self._chunkcachesize <= 0: raise RevlogError(_('revlog chunk cache size %r is not greater '