perf: update perfindex to be more realistic
authorBoris Feld <boris.feld@octobus.net>
Fri, 23 Nov 2018 06:03:38 +0100
changeset 40817 e207f0d6c243
parent 40816 3984409e144b
child 40818 a0f2641ddd61
perf: update perfindex to be more realistic The previous code was creating a revlog manually, we now use the actual `localrepo` method to create it. We have to jump though extra hops to work around the impact of filecache.
contrib/perf.py
--- a/contrib/perf.py	Sun Dec 02 13:09:46 2018 -0800
+++ b/contrib/perf.py	Fri Nov 23 06:03:38 2018 +0100
@@ -999,11 +999,18 @@
     timer, fm = gettimer(ui, opts)
     mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
     n = repo[b"tip"].node()
-    svfs = getsvfs(repo)
+
+    unfi = repo.unfiltered()
+    # find the filecache func directly
+    # This avoid polluting the benchmark with the filecache logic
+    makecl = unfi.__class__.changelog.func
+    def setup():
+        # probably not necessary, but for good measure
+        clearchangelog(unfi)
     def d():
-        cl = mercurial.revlog.revlog(svfs, b"00changelog.i")
+        cl = makecl(unfi)
         cl.rev(n)
-    timer(d)
+    timer(d, setup=setup)
     fm.end()
 
 @command(b'perfstartup', formatteropts)