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

Siddharth Agarwal sid0 at fb.com
Fri Oct 3 22:23:25 CDT 2014


# HG changeset patch
# User Siddharth Agarwal <sid0 at 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.

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


More information about the Mercurial-devel mailing list