Skip to content
Snippets Groups Projects
Commit beda2c9d authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

repoview: bypass changelog method to computed cache key

Getting the data necessary for the cache key using the changelog/revlog method
adds a significant overhead. Given how simple the underlying implementation is
and often this code is ran, it makes sense to violate layering and directly
compute the data.

Testing `hg log` on Mozilla-central, this reduce the time spent on changelog
cache validation by an extra half:

before: 12.2s of 69s
after:   6.1s of 62s

Total speed up from this patch and it's parent is 3x

(With stupid python profiler overhead)

The global speedup without profiler overhead is still there,

Before: 51s
After:  39s (-23%)
parent 49a76d3d
No related branches found
No related tags found
No related merge requests found
......@@ -300,5 +300,10 @@
# some cache may be implemented later
unfi = self._unfilteredrepo
unfichangelog = unfi.changelog
# bypass call to changelog.method
unfiindex = unfichangelog.index
unfilen = len(unfiindex) - 1
unfinode = unfiindex[unfilen - 1][7]
revs = filterrevs(unfi, self.filtername)
cl = self._clcache
......@@ -303,10 +308,8 @@
revs = filterrevs(unfi, self.filtername)
cl = self._clcache
newkey = (len(unfichangelog), unfichangelog.tip(), hash(revs),
unfichangelog._delayed)
if cl is not None:
if newkey != self._clcachekey:
cl = None
newkey = (unfilen, unfinode, hash(revs), unfichangelog._delayed)
if cl is not None and newkey != self._clcachekey:
cl = None
# could have been made None by the previous if
if cl is None:
cl = copy.copy(unfichangelog)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment