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

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 4, 2014, 3:23 a.m.
Message ID <5b9344d9025ff4325805.1412393005@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6102/
State Superseded
Headers show

Comments

Siddharth Agarwal - Oct. 4, 2014, 3:23 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1412391506 25200
#      Fri Oct 03 19:58:26 2014 -0700
# Node ID 5b9344d9025ff4325805b87ff53e3656778193f6
# Parent  56043613a4f5c1d0975b7eb30577284fe33c1edf
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