diff contrib/perf.py @ 16309:e0c1b3ef7c36

perf: node lookup
author Matt Mackall <mpm@selenic.com>
date Fri, 30 Mar 2012 14:16:06 -0500
parents 77d56a5e74a5
children ccc173d0914e
line wrap: on
line diff
--- a/contrib/perf.py	Fri Mar 23 01:31:31 2012 +0100
+++ b/contrib/perf.py	Fri Mar 30 14:16:06 2012 -0500
@@ -111,6 +111,15 @@
 def perflookup(ui, repo, rev):
     timer(lambda: len(repo.lookup(rev)))
 
+def perfnodelookup(ui, repo, rev):
+    import mercurial.revlog
+    mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
+    n = repo[rev].node()
+    def d():
+        cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i")
+        cl.rev(n)
+    timer(d)
+
 def perflog(ui, repo, **opts):
     ui.pushbuffer()
     timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
@@ -153,6 +162,7 @@
 
 cmdtable = {
     'perflookup': (perflookup, []),
+    'perfnodelookup': (perfnodelookup, []),
     'perfparents': (perfparents, []),
     'perfstartup': (perfstartup, []),
     'perfstatus': (perfstatus, []),