[PATCH 1 of 2] perf: add a perfancestors benchmark

Bryan O'Sullivan bos at serpentine.com
Tue May 15 12:46:52 CDT 2012


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1337103857 25200
# Node ID 4c5bca2a37682d39974eb38b5b313597a981b50a
# Parent  76c744e0c5bbd0900beba49787b7e04ba862939b
perf: add a perfancestors benchmark

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -57,6 +57,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():
@@ -215,6 +222,7 @@
     'perfindex': (perfindex, []),
     'perfheads': (perfheads, []),
     'perftags': (perftags, []),
+    'perfancestors': (perfancestors, []),
     'perfdirstate': (perfdirstate, []),
     'perfdirstatedirs': (perfdirstate, []),
     'perflog': (perflog,


More information about the Mercurial-devel mailing list