Patchwork [3,of,5,V2] perf: add a way to measure the perf of constructing the foldmap

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 4, 2014, 7:01 p.m.
Message ID <86352345087272e47c71.1412449293@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6119/
State Accepted
Commit d8ff1f671aeda6b568636895f94e4cf0988190b6
Headers show

Comments

Siddharth Agarwal - Oct. 4, 2014, 7:01 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1412391506 25200
#      Fri Oct 03 19:58:26 2014 -0700
# Node ID 86352345087272e47c716bd9f797938837a87d72
# Parent  de61082ab9e70a527885970322c2b1c92035abda
perf: add a way to measure the perf of constructing the foldmap

Constructing the foldmap is a necessary part of operations like 'hg status' on
OS X. This command allows us to measure the perf of constructing it.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -139,6 +139,16 @@ 
         del repo.dirstate._dirs
     timer(d)
 
+@command('perfdirstatefoldmap')
+def perffoldmap(ui, repo):
+    dirstate = repo.dirstate
+    'a' in dirstate
+    def d():
+        dirstate._foldmap.get('a')
+        del dirstate._foldmap
+        del dirstate._dirs
+    timer(d)
+
 @command('perfdirstatewrite')
 def perfdirstatewrite(ui, repo):
     ds = repo.dirstate