changeset 16802:7e5d94381cd1

perf: add a perfancestors benchmark
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 15 May 2012 10:44:17 -0700
parents f694ab54b660
children 107a3270a24a
files contrib/perf.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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, []),