perf: add a perfancestors benchmark
authorBryan O'Sullivan <bryano@fb.com>
Tue, 15 May 2012 10:44:17 -0700
changeset 16802 7e5d94381cd1
parent 16801 f694ab54b660
child 16803 107a3270a24a
perf: add a perfancestors benchmark
contrib/perf.py
--- a/contrib/perf.py	Wed May 30 14:31:51 2012 -0500
+++ b/contrib/perf.py	Tue May 15 10:44:17 2012 -0700
@@ -71,6 +71,13 @@
         return len(repo.tags())
     timer(t)
 
+def perfancestors(ui, repo):
+    heads = repo.changelog.headrevs()
+    def d():
+        for a in repo.changelog.ancestors(*heads):
+            pass
+    timer(d)
+
 def perfdirstate(ui, repo):
     "a" in repo.dirstate
     def d():
@@ -226,6 +233,7 @@
     'perfindex': (perfindex, []),
     'perfheads': (perfheads, []),
     'perftags': (perftags, []),
+    'perfancestors': (perfancestors, []),
     'perfdirstate': (perfdirstate, []),
     'perfdirstatedirs': (perfdirstate, []),
     'perfdirstatewrite': (perfdirstatewrite, []),