Mercurial > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
45522:93a0f3ba36bb | 45523:89f0d9f87701 |
---|---|
401 | 401 |
402 self._realopener = opener | 402 self._realopener = opener |
403 self._delayed = False | 403 self._delayed = False |
404 self._delaybuf = None | 404 self._delaybuf = None |
405 self._divert = False | 405 self._divert = False |
406 self.filteredrevs = frozenset() | 406 self._filteredrevs = frozenset() |
407 self._filteredrevs_hashcache = {} | |
407 self._copiesstorage = opener.options.get(b'copies-storage') | 408 self._copiesstorage = opener.options.get(b'copies-storage') |
409 | |
410 @property | |
411 def filteredrevs(self): | |
412 return self._filteredrevs | |
413 | |
414 @filteredrevs.setter | |
415 def filteredrevs(self, val): | |
416 # Ensure all updates go through this function | |
417 assert isinstance(val, frozenset) | |
418 self._filteredrevs = val | |
419 self._filteredrevs_hashcache = {} | |
408 | 420 |
409 def delayupdate(self, tr): | 421 def delayupdate(self, tr): |
410 """delay visibility of index updates to other readers""" | 422 """delay visibility of index updates to other readers""" |
411 | 423 |
412 if not self._delayed: | 424 if not self._delayed: |