Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 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 | edf4fa06df94 |
children | a5206e71c536 |
comparison
equal
deleted
inserted
replaced
45778:6620caf427ec | 45779:8719a5b68419 |
---|---|
666 ) | 666 ) |
667 self.index, self._chunkcache = d | 667 self.index, self._chunkcache = d |
668 if not self._chunkcache: | 668 if not self._chunkcache: |
669 self._chunkclear() | 669 self._chunkclear() |
670 # revnum -> (chain-length, sum-delta-length) | 670 # revnum -> (chain-length, sum-delta-length) |
671 self._chaininfocache = {} | 671 self._chaininfocache = util.lrucachedict(500) |
672 # revlog header -> revlog compressor | 672 # revlog header -> revlog compressor |
673 self._decompressors = {} | 673 self._decompressors = {} |
674 | 674 |
675 @util.propertycache | 675 @util.propertycache |
676 def _compressor(self): | 676 def _compressor(self): |
2548 | 2548 |
2549 transaction.add(self.indexfile, end) | 2549 transaction.add(self.indexfile, end) |
2550 | 2550 |
2551 # then reset internal state in memory to forget those revisions | 2551 # then reset internal state in memory to forget those revisions |
2552 self._revisioncache = None | 2552 self._revisioncache = None |
2553 self._chaininfocache = {} | 2553 self._chaininfocache = util.lrucachedict(500) |
2554 self._chunkclear() | 2554 self._chunkclear() |
2555 | 2555 |
2556 del self.index[rev:-1] | 2556 del self.index[rev:-1] |
2557 | 2557 |
2558 def checksize(self): | 2558 def checksize(self): |