Patchwork [2,of,3] sparse-read: skip gaps too small to be worth splitting

login
register
mail settings
Submitter Paul Morelle
Date Oct. 18, 2017, 2:36 p.m.
Message ID <1c47a1306c856a240d91.1508337382@taranis.localdomain>
Download mbox | patch
Permalink /patch/25168/
State Accepted
Headers show

Comments

Paul Morelle - Oct. 18, 2017, 2:36 p.m.
# HG changeset patch
# User Paul Morelle <paul.morelle@octobus.net>
# Date 1508310468 -7200
#      Wed Oct 18 09:07:48 2017 +0200
# Node ID 1c47a1306c856a240d9191e0f928b07493078fa7
# Parent  495cbf44112b9872f2803ccd836de3ffae30b28c
# EXP-Topic optimized-read
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1c47a1306c85
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.

Patch

diff -r 495cbf44112b -r 1c47a1306c85 mercurial/configitems.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
@@ -420,7 +420,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',
diff -r 495cbf44112b -r 1c47a1306c85 mercurial/localrepo.py
--- 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-'):
diff -r 495cbf44112b -r 1c47a1306c85 mercurial/revlog.py
--- 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 '