Patchwork [1,of,2] repoview: stop recomputing cached key in all case

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 4, 2015, 11:06 p.m.
Message ID <8daa6d98b6f67d39389b.1449270417@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11827/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Pierre-Yves David - Dec. 4, 2015, 11:06 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1449266664 28800
#      Fri Dec 04 14:04:24 2015 -0800
# Node ID 8daa6d98b6f67d39389bbd91d0a034466e1c965d
# Parent  79db86a0884617202808e979181819df2faaf0c2
# EXP-Topic clcachekey
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 8daa6d98b6f6
repoview: stop recomputing cached key in all case

As explained in the comment, we were computing the key of the cache value every
time because of some obscure MQ test failure. I've dropped that code and ran the
test again that failure is gone. I assume some transaction cleanup got read of
it.

So we are dropping that code. This provide a significant speedup.

Testing `hg log` on Mozilla-central this reduce the time spent on changelog
cache validation by a third:

before: 19.5s of 80s
after:  12.2s of 69s

(With stupid python profiler overhead)
timeless - Dec. 6, 2015, 3:27 a.m.
Pierre-Yves David wrote:
> I assume some transaction cleanup got read of it.

read => rid

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -303,20 +303,11 @@  class repoview(object):
         revs = filterrevs(unfi, self.filtername)
         cl = self._clcache
         newkey = (len(unfichangelog), unfichangelog.tip(), hash(revs),
                   unfichangelog._delayed)
         if cl is not None:
-            # we need to check curkey too for some obscure reason.
-            # MQ test show a corruption of the underlying repo (in _clcache)
-            # without change in the cachekey.
-            oldfilter = cl.filteredrevs
-            try:
-                cl.filteredrevs = ()  # disable filtering for tip
-                curkey = (len(cl), cl.tip(), hash(oldfilter), cl._delayed)
-            finally:
-                cl.filteredrevs = oldfilter
-            if newkey != self._clcachekey or newkey != curkey:
+            if newkey != self._clcachekey:
                 cl = None
         # could have been made None by the previous if
         if cl is None:
             cl = copy.copy(unfichangelog)
             cl.filteredrevs = revs