diff mercurial/revlog.py @ 34825:4d5d5009bd75

revlog-sparse-read: add a lower-threshold for read block size The option experimental.sparse-read.min-block-size specifies the minimal size of a deltachain span, under which it won't be split by _slicechunk.
author Paul Morelle <paul.morelle@octobus.net>
date Sat, 14 Oct 2017 17:05:41 +0200
parents e2ad93bcc084
children 9e18ab7f7240
line wrap: on
line diff
--- a/mercurial/revlog.py	Tue Oct 10 17:50:27 2017 +0200
+++ b/mercurial/revlog.py	Sat Oct 14 17:05:41 2017 +0200
@@ -180,7 +180,7 @@
         endbyte = start(revs[-1]) + length(revs[-1])
         deltachainspan = endbyte - startbyte
 
-        if len(revs) <= 1:
+        if deltachainspan <= revlog._srminblocksize or len(revs) <= 1:
             yield revs
             continue
 
@@ -360,6 +360,7 @@
         self._maxdeltachainspan = -1
         self._withsparseread = False
         self._srdensitythreshold = 0.25
+        self._srminblocksize = 262144
 
         mmapindexthreshold = None
         v = REVLOG_DEFAULT_VERSION
@@ -389,6 +390,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 self._chunkcachesize <= 0:
             raise RevlogError(_('revlog chunk cache size %r is not greater '