diff mercurial/manifest.py @ 24033:ed5e8a9598ce

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.
author Durham Goode <durham@fb.com>
date Fri, 23 Jan 2015 17:06:03 -0800
parents 399a8403cb54
children dd8c891dd09a
line wrap: on
line diff
--- a/mercurial/manifest.py	Wed Feb 04 11:38:30 2015 -0500
+++ b/mercurial/manifest.py	Fri Jan 23 17:06:03 2015 -0800
@@ -220,9 +220,14 @@
 
 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):