Patchwork [1,of,4] perf: update perfindex to be more realistic

login
register
mail settings
Submitter Boris Feld
Date Dec. 2, 2018, 4:17 p.m.
Message ID <63dc9727cc56dcf4995f.1543767460@pc62.home>
Download mbox | patch
Permalink /patch/36903/
State Accepted
Headers show

Comments

Boris Feld - Dec. 2, 2018, 4:17 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1542949418 -3600
#      Fri Nov 23 06:03:38 2018 +0100
# Node ID 63dc9727cc56dcf4995f45fdabb3c56ef84e4389
# Parent  5cbb74999040905c12dff2695817f7e19c841a4d
# EXP-Topic mmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 63dc9727cc56
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.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -999,11 +999,18 @@  def perfindex(ui, repo, **opts):
     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)