Patchwork [2,of,6] perf: add perfdirs command

login
register
mail settings
Submitter Bryan O'Sullivan
Date March 29, 2013, 1:22 a.m.
Message ID <42348ed8d9a218eee27b.1364520164@australite.local>
Download mbox | patch
Permalink /patch/1209/
State Accepted
Commit c1f416e4bc80471d1cdbc58d136b67c98793b832
Headers show

Comments

Bryan O'Sullivan - March 29, 2013, 1:22 a.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@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.

Patch

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)
 
+@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