changeset 45779:8719a5b68419

revlog: use LRU for the chain cache For a large repository, this reduces the number of filelog instances and associated data a lot. For a 1% speed penalty, it reduces peak RSS by 20% for the full NetBSD test repository. Differential Revision: https://phab.mercurial-scm.org/D9235
author Joerg Sonnenberger <joerg@bec.de>
date Wed, 21 Oct 2020 01:48:09 +0200
parents 6620caf427ec
children ae2873e92250
files mercurial/revlog.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Oct 14 08:38:58 2020 -0700
+++ b/mercurial/revlog.py	Wed Oct 21 01:48:09 2020 +0200
@@ -668,7 +668,7 @@
         if not self._chunkcache:
             self._chunkclear()
         # revnum -> (chain-length, sum-delta-length)
-        self._chaininfocache = {}
+        self._chaininfocache = util.lrucachedict(500)
         # revlog header -> revlog compressor
         self._decompressors = {}
 
@@ -2550,7 +2550,7 @@
 
         # then reset internal state in memory to forget those revisions
         self._revisioncache = None
-        self._chaininfocache = {}
+        self._chaininfocache = util.lrucachedict(500)
         self._chunkclear()
 
         del self.index[rev:-1]