sparse-read: skip gaps too small to be worth splitting
authorPaul Morelle <paul.morelle@octobus.net>
Wed, 18 Oct 2017 09:07:48 +0200
changeset 34881 8c9b08a0c48c
parent 34880 9e18ab7f7240
child 34882 e9f320a40b44
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.
mercurial/configitems.py
mercurial/localrepo.py
mercurial/revlog.py
--- a/mercurial/configitems.py	Wed Oct 18 12:53:00 2017 +0200
+++ b/mercurial/configitems.py	Wed Oct 18 09:07:48 2017 +0200
@@ -444,7 +444,7 @@
 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',
--- a/mercurial/localrepo.py	Wed Oct 18 12:53:00 2017 +0200
+++ b/mercurial/localrepo.py	Wed Oct 18 09:07:48 2017 +0200
@@ -611,11 +611,11 @@
         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-'):
--- a/mercurial/revlog.py	Wed Oct 18 12:53:00 2017 +0200
+++ b/mercurial/revlog.py	Wed Oct 18 09:07:48 2017 +0200
@@ -196,7 +196,8 @@
 
         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 @@
         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 @@
             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 '