comparison mercurial/revlog.py @ 42462:bc4373babd04

revlog: add the option to track the expected compression upper bound There are various optimization we can do if we can estimate the size of delta before actually spending CPU compressing them. So we add a attributed dedicated to tracking that. We only use it on Manifest because (1) it structure is quite stable across all Mercurial repository so its compression ratio is fairly universal. This is the revlog with most extreme delta (cf the sparse-revlog optimization). This will be put to use in later changesets. Right now the compression upper bound is set to 10. This is a fairly conservative value (observed value is more around 3), but I prefer to be safe while introducing the optimization principles. We can tune the optimization threshold later.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 26 Apr 2019 00:28:22 +0200
parents a3a8887e4426
children 4eaf7197a740
comparison
equal deleted inserted replaced
42461:74e2f4b609f6 42462:bc4373babd04
332 If mmaplargeindex is True, and an mmapindexthreshold is set, the 332 If mmaplargeindex is True, and an mmapindexthreshold is set, the
333 index will be mmapped rather than read if it is larger than the 333 index will be mmapped rather than read if it is larger than the
334 configured threshold. 334 configured threshold.
335 335
336 If censorable is True, the revlog can have censored revisions. 336 If censorable is True, the revlog can have censored revisions.
337
338 If `upperboundcomp` is not None, this is the expected maximal gain from
339 compression for the data content.
337 """ 340 """
338 def __init__(self, opener, indexfile, datafile=None, checkambig=False, 341 def __init__(self, opener, indexfile, datafile=None, checkambig=False,
339 mmaplargeindex=False, censorable=False): 342 mmaplargeindex=False, censorable=False,
343 upperboundcomp=None):
340 """ 344 """
341 create a revlog object 345 create a revlog object
342 346
343 opener is a function that abstracts the file opening operation 347 opener is a function that abstracts the file opening operation
344 and can be used to implement COW semantics or the like. 348 and can be used to implement COW semantics or the like.
345 """ 349
350 """
351 self.upperboundcomp = upperboundcomp
346 self.indexfile = indexfile 352 self.indexfile = indexfile
347 self.datafile = datafile or (indexfile[:-2] + ".d") 353 self.datafile = datafile or (indexfile[:-2] + ".d")
348 self.opener = opener 354 self.opener = opener
349 # When True, indexfile is opened with checkambig=True at writing, to 355 # When True, indexfile is opened with checkambig=True at writing, to
350 # avoid file stat ambiguity. 356 # avoid file stat ambiguity.