Mercurial > public > mercurial-scm > hg-stable
diff mercurial/changelog.py @ 45523:89f0d9f87701
branchmap: add a cache validation cache, avoid expensive re-hash on every use
In a pathological `hg log` case, we end up executing the branchmap validity
checking twice per commit displayed. Or maybe we always do, and I just noticed
because it's really slow in this repo for some reason.
Before:
```
Time (mean ? ?): 9.816 s ? 0.071 s [User: 9.435 s, System: 0.392 s]
Range (min ? max): 9.709 s ? 9.920 s
```
After:
```
Time (mean ? ?): 8.671 s ? 0.078 s [User: 8.309 s, System: 0.392 s]
Range (min ? max): 8.594 s ? 8.816 s
```
Differential Revision: https://phab.mercurial-scm.org/D9023
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Wed, 16 Sep 2020 12:13:46 -0700 |
parents | c6eea5804551 |
children | 64d18e9e8508 |
line wrap: on
line diff
--- a/mercurial/changelog.py Mon Sep 21 15:05:38 2020 -0400 +++ b/mercurial/changelog.py Wed Sep 16 12:13:46 2020 -0700 @@ -403,9 +403,21 @@ self._delayed = False self._delaybuf = None self._divert = False - self.filteredrevs = frozenset() + self._filteredrevs = frozenset() + self._filteredrevs_hashcache = {} self._copiesstorage = opener.options.get(b'copies-storage') + @property + def filteredrevs(self): + return self._filteredrevs + + @filteredrevs.setter + def filteredrevs(self, val): + # Ensure all updates go through this function + assert isinstance(val, frozenset) + self._filteredrevs = val + self._filteredrevs_hashcache = {} + def delayupdate(self, tr): """delay visibility of index updates to other readers"""