# HG changeset patch # User Durham Goode # Date 2015-01-24 01:06:03 # Node ID ed5e8a9598cea22b20503ef969cc796ad9a71ea9 # Parent c53bc2e52514825cbd40d29dd08693c8a640256e manifest: make lru size configurable On machines with lots of ram, it's beneficial to increase the lru size of the manifest cache. On a large repo, configuring the lru to be size 10 can shave a large rebase (~12 commits) down from 95s to 70s. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -323,6 +323,9 @@ class localrepository(object): maxchainlen = self.ui.configint('format', 'maxchainlen') if maxchainlen is not None: self.svfs.options['maxchainlen'] = maxchainlen + manifestcachesize = self.ui.configint('format', 'manifestcachesize') + if manifestcachesize is not None: + self.svfs.options['manifestcachesize'] = manifestcachesize def _writerequirements(self): reqfile = self.vfs("requires", "w") diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -220,9 +220,14 @@ def _parse(lines): class manifest(revlog.revlog): def __init__(self, opener): - # we expect to deal with not more than four revs at a time, - # during a commit --amend - self._mancache = util.lrucachedict(4) + # During normal operations, we expect to deal with not more than four + # revs at a time (such as during commit --amend). When rebasing large + # stacks of commits, the number can go up, hence the config knob below. + cachesize = 4 + opts = getattr(opener, 'options', None) + if opts is not None: + cachesize = opts.get('manifestcachesize', cachesize) + self._mancache = util.lrucachedict(cachesize) revlog.revlog.__init__(self, opener, "00manifest.i") def readdelta(self, node):