diff contrib/perf.py @ 19292:e0aa6fff8f02

annotate: simplify annotate parent function The annotate algorithm used a custom parents() function to try to reuse filectx and filelogs. I simplified it a bit to rely more heavily on the self.parents() which makes it work well with alternative filectx implementations. I tested performance on a file with 5000+ revisions but no renames, and on a file with 500 revisions repeating a series of 4 edits+renames and saw zero performance hit. In fact, it was reliably a couple milliseconds faster now. Added the perfannotate command to contrib/perf.py for future use.
author Durham Goode <durham@fb.com>
date Thu, 30 May 2013 19:29:03 -0700
parents 2e9fe9e2671f
children ff1586a3adc5
line wrap: on
line diff
--- a/contrib/perf.py	Thu May 30 19:26:56 2013 -0700
+++ b/contrib/perf.py	Thu May 30 19:29:03 2013 -0700
@@ -45,6 +45,11 @@
         except Exception:
             timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
 
+@command('perfannotate')
+def perfannotate(ui, repo, f):
+    fc = repo['.'][f]
+    timer(lambda: len(fc.annotate(True)))
+
 @command('perfstatus',
          [('u', 'unknown', False,
            'ask status to look for unknown files')])