changeset 40783:e207f0d6c243

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.
author Boris Feld <boris.feld@octobus.net>
date Fri, 23 Nov 2018 06:03:38 +0100
parents 3984409e144b
children a0f2641ddd61
files contrib/perf.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)