[PATCH 2 of 6] perf: add perfdirs command

Bryan O'Sullivan bos at serpentine.com
Thu Mar 28 20:22:44 CDT 2013


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1364520149 25200
#      Thu Mar 28 18:22:29 2013 -0700
# Node ID 42348ed8d9a218eee27b40b48d368aed552c1452
# Parent  d6bb127c3380f9ee622703d87bae4bc1fd0f8421
perf: add perfdirs command

This measures the cost of computing the dirstate's dirs structure,
which becomes very expensive in a large working directory.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -99,6 +99,15 @@ def perfancestorset(ui, repo, revset):
             rev in s
     timer(d)
 
+ at command('perfdirs')
+def perfdirs(ui, repo):
+    dirstate = repo.dirstate
+    'a' in dirstate
+    def d():
+        dirstate.iterdirs()
+        del dirstate._dirs
+    timer(d)
+
 @command('perfdirstate')
 def perfdirstate(ui, repo):
     "a" in repo.dirstate


More information about the Mercurial-devel mailing list