Patchwork [4,of,4] dirstate.walk: fast path none-seen + match-always case for step 3

login
register
mail settings
Submitter Siddharth Agarwal
Date March 23, 2013, 2:37 a.m.
Message ID <009929458ae8a97e342f.1364006224@sid0x220>
Download mbox | patch
Permalink /patch/1173/
State Superseded
Commit a18919de61e5a11747a8856e6acfbaaa457fb479
Headers show

Comments

Siddharth Agarwal - March 23, 2013, 2:37 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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.

Patch

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