Mercurial > hg
comparison mercurial/manifest.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 | 12bd4e2d4d06 |
children | 4a3abb33380a |
comparison
equal
deleted
inserted
replaced
42461:74e2f4b609f6 | 42462:bc4373babd04 |
---|---|
1415 if clear_persisted_data: | 1415 if clear_persisted_data: |
1416 self._dirty = True | 1416 self._dirty = True |
1417 self.write() | 1417 self.write() |
1418 self._read = False | 1418 self._read = False |
1419 | 1419 |
1420 # and upper bound of what we expect from compression | |
1421 # (real live value seems to be "3") | |
1422 MAXCOMPRESSION = 10 | |
1423 | |
1420 @interfaceutil.implementer(repository.imanifeststorage) | 1424 @interfaceutil.implementer(repository.imanifeststorage) |
1421 class manifestrevlog(object): | 1425 class manifestrevlog(object): |
1422 '''A revlog that stores manifest texts. This is responsible for caching the | 1426 '''A revlog that stores manifest texts. This is responsible for caching the |
1423 full-text manifest contents. | 1427 full-text manifest contents. |
1424 ''' | 1428 ''' |
1465 self._dirlogcache = {'': self} | 1469 self._dirlogcache = {'': self} |
1466 | 1470 |
1467 self._revlog = revlog.revlog(opener, indexfile, | 1471 self._revlog = revlog.revlog(opener, indexfile, |
1468 # only root indexfile is cached | 1472 # only root indexfile is cached |
1469 checkambig=not bool(tree), | 1473 checkambig=not bool(tree), |
1470 mmaplargeindex=True) | 1474 mmaplargeindex=True, |
1475 upperboundcomp=MAXCOMPRESSION) | |
1471 | 1476 |
1472 self.index = self._revlog.index | 1477 self.index = self._revlog.index |
1473 self.version = self._revlog.version | 1478 self.version = self._revlog.version |
1474 self._generaldelta = self._revlog._generaldelta | 1479 self._generaldelta = self._revlog._generaldelta |
1475 | 1480 |