changeset 7872:f680a1bd679b

contrib: add perflog and perftemplating commands to perf extension
author Alexander Solovyov <piranha@piranha.org.ua>
date Mon, 23 Mar 2009 13:12:03 +0100
parents cdbe19abd1c5
children 4a4c7f6a5912
files contrib/perf.py
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Mon Mar 23 13:12:44 2009 +0100
+++ b/contrib/perf.py	Mon Mar 23 13:12:03 2009 +0100
@@ -1,7 +1,7 @@
 # perf.py - performance test routines
 
 from mercurial.i18n import _
-from mercurial import cmdutil, match
+from mercurial import cmdutil, match, commands
 import time, os, sys
 
 def timer(func):
@@ -101,6 +101,18 @@
 def perflookup(ui, repo, rev):
     timer(lambda: len(repo.lookup(rev)))
 
+def perflog(ui, repo):
+    ui.pushbuffer()
+    timer(lambda: commands.log(ui, repo, rev=[], date='', user=''))
+    ui.popbuffer()
+
+def perftemplating(ui, repo):
+    ui.pushbuffer()
+    timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
+                               template='{date|shortdate} [{rev}:{node|short}]'
+                               ' {author|person}: {desc|firstline}\n'))
+    ui.popbuffer()
+
 cmdtable = {
     'perflookup': (perflookup, []),
     'perfparents': (perfparents, []),
@@ -113,5 +125,7 @@
     'perftags': (perftags, []),
     'perfdirstate': (perfdirstate, []),
     'perfdirstatedirs': (perfdirstate, []),
+    'perflog': (perflog, []),
+    'perftemplating': (perftemplating, []),
 }