[PATCH 4 of 4] dirstate.walk: fast path none-seen + match-always case for step 3
Siddharth Agarwal
sid0 at fb.com
Fri Mar 22 21:37:04 CDT 2013
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1363997029 25200
# Fri Mar 22 17:03:49 2013 -0700
# Node ID 009929458ae8a97e342fe7fbbdbada8798870aa1
# Parent c7d166d7e6f33d7888b2980977c8d32d4bfbd87f
dirstate.walk: fast path none-seen + match-always case for step 3
This case is a common one -- e.g. `hg diff`.
For a repository with 170,000 files, this speeds up perfstatus from 0.95
seconds to 0.88.
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -702,7 +702,12 @@ class dirstate(object):
# step 3: report unseen items in the dmap hash
if not skipstep3 and not exact:
- visit = sorted([f for f in dmap if f not in results and matchfn(f)])
+ if not results and matchalways:
+ visit = dmap.keys()
+ else:
+ visit = [f for f in dmap if f not in results and matchfn(f)]
+ visit.sort()
+
if unknown:
# unknown == True means we walked the full directory tree above.
# So if a file is not seen it was either a) not matching matchfn
More information about the Mercurial-devel
mailing list