perf: node lookup
authorMatt Mackall <mpm@selenic.com>
Fri, 30 Mar 2012 14:16:06 -0500
changeset 16309 e0c1b3ef7c36
parent 16308 2695aaf4eb72
child 16310 8ac2c91855cf
perf: node lookup
contrib/perf.py
--- 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, []),