comparison 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
comparison
equal deleted inserted replaced
34824:e2ad93bcc084 34825:4d5d5009bd75
178 178
179 startbyte = start(revs[0]) 179 startbyte = start(revs[0])
180 endbyte = start(revs[-1]) + length(revs[-1]) 180 endbyte = start(revs[-1]) + length(revs[-1])
181 deltachainspan = endbyte - startbyte 181 deltachainspan = endbyte - startbyte
182 182
183 if len(revs) <= 1: 183 if deltachainspan <= revlog._srminblocksize or len(revs) <= 1:
184 yield revs 184 yield revs
185 continue 185 continue
186 186
187 # Find where is the largest hole (this is where we would split) and 187 # Find where is the largest hole (this is where we would split) and
188 # sum up the lengths of useful data to compute the density of the span 188 # sum up the lengths of useful data to compute the density of the span
358 self._nodepos = None 358 self._nodepos = None
359 self._compengine = 'zlib' 359 self._compengine = 'zlib'
360 self._maxdeltachainspan = -1 360 self._maxdeltachainspan = -1
361 self._withsparseread = False 361 self._withsparseread = False
362 self._srdensitythreshold = 0.25 362 self._srdensitythreshold = 0.25
363 self._srminblocksize = 262144
363 364
364 mmapindexthreshold = None 365 mmapindexthreshold = None
365 v = REVLOG_DEFAULT_VERSION 366 v = REVLOG_DEFAULT_VERSION
366 opts = getattr(opener, 'options', None) 367 opts = getattr(opener, 'options', None)
367 if opts is not None: 368 if opts is not None:
387 if mmaplargeindex and 'mmapindexthreshold' in opts: 388 if mmaplargeindex and 'mmapindexthreshold' in opts:
388 mmapindexthreshold = opts['mmapindexthreshold'] 389 mmapindexthreshold = opts['mmapindexthreshold']
389 self._withsparseread = bool(opts.get('with-sparse-read', False)) 390 self._withsparseread = bool(opts.get('with-sparse-read', False))
390 if 'sparse-read-density-threshold' in opts: 391 if 'sparse-read-density-threshold' in opts:
391 self._srdensitythreshold = opts['sparse-read-density-threshold'] 392 self._srdensitythreshold = opts['sparse-read-density-threshold']
393 if 'sparse-read-min-block-size' in opts:
394 self._srminblocksize = opts['sparse-read-min-block-size']
392 395
393 if self._chunkcachesize <= 0: 396 if self._chunkcachesize <= 0:
394 raise RevlogError(_('revlog chunk cache size %r is not greater ' 397 raise RevlogError(_('revlog chunk cache size %r is not greater '
395 'than 0') % self._chunkcachesize) 398 'than 0') % self._chunkcachesize)
396 elif self._chunkcachesize & (self._chunkcachesize - 1): 399 elif self._chunkcachesize & (self._chunkcachesize - 1):