# HG changeset patch
# User Boris Feld <boris.f...@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.

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)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to