[PATCH 1 of 6 V2] perf: add a command to test addremove performance

Siddharth Agarwal sid0 at fb.com
Tue Apr 2 16:52:53 CDT 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1364882976 25200
#      Mon Apr 01 23:09:36 2013 -0700
# Node ID d723353c8a0ab2ced8606014abee43aa0b1e3fa4
# Parent  4335ea327027234ef72e2a342fb163be15ce6007
perf: add a command to test addremove performance

Upcoming patches will improve addremove performance. This command will be used
to demonstrate that improvement.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -54,6 +54,15 @@ def perfstatus(ui, repo, **opts):
     #                                                False))))
     timer(lambda: sum(map(len, repo.status(**opts))))
 
+ at command('perfaddremove')
+def perfaddremove(ui, repo):
+    try:
+        oldquiet = repo.ui.quiet
+        repo.ui.quiet = True
+        timer(lambda: scmutil.addremove(repo, dry_run=True))
+    finally:
+        repo.ui.quiet = oldquiet
+
 def clearcaches(cl):
     # behave somewhat consistently across internal API changes
     if util.safehasattr(cl, 'clearcaches'):


More information about the Mercurial-devel mailing list