Patchwork [3,of,3] dirstate: inline more properties and methods in status

login
register
mail settings
Submitter Siddharth Agarwal
Date Dec. 3, 2012, 10:23 p.m.
Message ID <a17491c6a1cf2ec1bb12.1354573435@sid0x220>
Download mbox | patch
Permalink /patch/3/
State Accepted
Commit 1a570f04de0772f158d372c06d543053fb20fec2
Headers show

Comments

Siddharth Agarwal - Dec. 3, 2012, 10:23 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1354573305 28800
# Node ID a17491c6a1cf2ec1bb129e2b4341581d31eeac22
# Parent  98f5d2b441abc677c2b2fbaa3900de2afc193247
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)
Matt Mackall - Dec. 3, 2012, 10:36 p.m.
On Mon, 2012-12-03 at 14:23 -0800, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1354573305 28800
> # Node ID a17491c6a1cf2ec1bb129e2b4341581d31eeac22
> # Parent  98f5d2b441abc677c2b2fbaa3900de2afc193247
> dirstate: inline more properties and methods in status

Queued for default, thanks.

Patch

diff -r 98f5d2b441ab -r a17491c6a1cf mercurial/dirstate.py
--- a/mercurial/dirstate.py	Mon Dec 03 13:42:42 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.