[PATCH 3 of 4] dirstate.walk: fast path match-always case during traversal
Siddharth Agarwal
sid0 at fb.com
Fri Mar 22 21:37:03 CDT 2013
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1363996980 25200
# Fri Mar 22 17:03:00 2013 -0700
# Node ID c7d166d7e6f33d7888b2980977c8d32d4bfbd87f
# Parent 90293fb6b3d77c76a5985f7003bdeac8d60878e0
dirstate.walk: fast path match-always case during traversal
This case is a common one -- e.g. `hg status`.
For a repository with 170,000 files, this speeds up perfstatus --unknown from
2.15 seconds to 2.09.
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -577,6 +577,7 @@ class dirstate(object):
dirignore = util.always
matchfn = match.matchfn
+ matchalways = match.always()
badfn = match.bad
dmap = self._map
normpath = util.normpath
@@ -684,15 +685,15 @@ class dirstate(object):
if not ignore(nf):
match.dir(nf)
wadd(nf)
- if nf in dmap and matchfn(nf):
+ if nf in dmap and (matchalways or matchfn(nf)):
results[nf] = None
elif kind == regkind or kind == lnkkind:
if nf in dmap:
- if matchfn(nf):
+ if (matchalways or matchfn(nf)):
results[nf] = st
- elif matchfn(nf) and not ignore(nf):
+ elif (matchalways or matchfn(nf)) and not ignore(nf):
results[nf] = st
- elif nf in dmap and matchfn(nf):
+ elif nf in dmap and (matchalways or matchfn(nf)):
results[nf] = None
for s in subrepos:
More information about the Mercurial-devel
mailing list