comparison mercurial/revlog.py @ 34881:8c9b08a0c48c

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.
author Paul Morelle <paul.morelle@octobus.net>
date Wed, 18 Oct 2017 09:07:48 +0200
parents 9e18ab7f7240
children 1bde8e8e5de0
comparison
equal deleted inserted replaced
34880:9e18ab7f7240 34881:8c9b08a0c48c
194 revstart = start(rev) 194 revstart = start(rev)
195 revlen = length(rev) 195 revlen = length(rev)
196 196
197 if prevend is not None: 197 if prevend is not None:
198 gapsize = revstart - prevend 198 gapsize = revstart - prevend
199 if gapsize: 199 # only consider holes that are large enough
200 if gapsize > revlog._srmingapsize:
200 heapq.heappush(gapsheap, (-gapsize, i)) 201 heapq.heappush(gapsheap, (-gapsize, i))
201 202
202 prevend = revstart + revlen 203 prevend = revstart + revlen
203 204
204 # Collect the indices of the largest holes until the density is acceptable 205 # Collect the indices of the largest holes until the density is acceptable
369 self._nodepos = None 370 self._nodepos = None
370 self._compengine = 'zlib' 371 self._compengine = 'zlib'
371 self._maxdeltachainspan = -1 372 self._maxdeltachainspan = -1
372 self._withsparseread = False 373 self._withsparseread = False
373 self._srdensitythreshold = 0.25 374 self._srdensitythreshold = 0.25
374 self._srminblocksize = 262144 375 self._srmingapsize = 262144
375 376
376 mmapindexthreshold = None 377 mmapindexthreshold = None
377 v = REVLOG_DEFAULT_VERSION 378 v = REVLOG_DEFAULT_VERSION
378 opts = getattr(opener, 'options', None) 379 opts = getattr(opener, 'options', None)
379 if opts is not None: 380 if opts is not None:
399 if mmaplargeindex and 'mmapindexthreshold' in opts: 400 if mmaplargeindex and 'mmapindexthreshold' in opts:
400 mmapindexthreshold = opts['mmapindexthreshold'] 401 mmapindexthreshold = opts['mmapindexthreshold']
401 self._withsparseread = bool(opts.get('with-sparse-read', False)) 402 self._withsparseread = bool(opts.get('with-sparse-read', False))
402 if 'sparse-read-density-threshold' in opts: 403 if 'sparse-read-density-threshold' in opts:
403 self._srdensitythreshold = opts['sparse-read-density-threshold'] 404 self._srdensitythreshold = opts['sparse-read-density-threshold']
404 if 'sparse-read-min-block-size' in opts: 405 if 'sparse-read-min-gap-size' in opts:
405 self._srminblocksize = opts['sparse-read-min-block-size'] 406 self._srmingapsize = opts['sparse-read-min-gap-size']
406 407
407 if self._chunkcachesize <= 0: 408 if self._chunkcachesize <= 0:
408 raise RevlogError(_('revlog chunk cache size %r is not greater ' 409 raise RevlogError(_('revlog chunk cache size %r is not greater '
409 'than 0') % self._chunkcachesize) 410 'than 0') % self._chunkcachesize)
410 elif self._chunkcachesize & (self._chunkcachesize - 1): 411 elif self._chunkcachesize & (self._chunkcachesize - 1):