changeset 18034:1a570f04de07

dirstate: inline more properties and methods in status hg perfstatus -u on a working directory with 170,000 files, without this change: ! wall 1.839561 comb 1.830000 user 1.120000 sys 0.710000 (best of 6) With this change: ! wall 1.804222 comb 1.790000 user 1.140000 sys 0.650000 (best of 6) hg perfstatus on the same directory, without this change: ! wall 1.016609 comb 1.020000 user 0.670000 sys 0.350000 (best of 10) With this change: ! wall 0.985573 comb 0.980000 user 0.650000 sys 0.330000 (best of 10)
author Siddharth Agarwal <sid0@fb.com>
date Mon, 03 Dec 2012 14:21:45 -0800
parents 00ac420f24ee
children 5881d5b7552f
files mercurial/dirstate.py
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Mon Dec 03 13:53:53 2012 -0800
+++ b/mercurial/dirstate.py	Mon Dec 03 14:21:45 2012 -0800
@@ -750,13 +750,19 @@
         radd = removed.append
         dadd = deleted.append
         cadd = clean.append
+        mexact = match.exact
+        dirignore = self._dirignore
+        checkexec = self._checkexec
+        checklink = self._checklink
+        copymap = self._copymap
+        lastnormaltime = self._lastnormaltime
 
         lnkkind = stat.S_IFLNK
 
         for fn, st in self.walk(match, subrepos, listunknown,
                                 listignored).iteritems():
             if fn not in dmap:
-                if (listignored or match.exact(fn)) and self._dirignore(fn):
+                if (listignored or mexact(fn)) and dirignore(fn):
                     if listignored:
                         iadd(fn)
                 elif listunknown:
@@ -775,15 +781,15 @@
                 mtime = int(st.st_mtime)
                 if (size >= 0 and
                     ((size != st.st_size and size != st.st_size & _rangemask)
-                     or ((mode ^ st.st_mode) & 0100 and self._checkexec))
-                    and (mode & lnkkind != lnkkind or self._checklink)
+                     or ((mode ^ st.st_mode) & 0100 and checkexec))
+                    and (mode & lnkkind != lnkkind or checklink)
                     or size == -2 # other parent
-                    or fn in self._copymap):
+                    or fn in copymap):
                     madd(fn)
                 elif ((time != mtime and time != mtime & _rangemask)
-                      and (mode & lnkkind != lnkkind or self._checklink)):
+                      and (mode & lnkkind != lnkkind or checklink)):
                     ladd(fn)
-                elif mtime == self._lastnormaltime:
+                elif mtime == lastnormaltime:
                     # fn may have been changed in the same timeslot without
                     # changing its size. This can happen if we quickly do
                     # multiple commits in a single transaction.