changeset 24396:9e03602cd2d8

manifest: avoid intersectfiles for matches > 100 files Previously we tried to avoid manifest.intersectfiles for exact matches with less than 100 files. However, when the left side of the "or" is false, the right side gets evaluated, of course, and the evaluation of "util.all(fn in self for fn in files)" is both costly in itself, and likely to be true, causing intersectfiles() to be called after all. Fix this by moving the check for less than 100 files outside of the "or" expression, thereby also making it apply for a non-exact matcher, should one be passed in.
author Durham Goode <durham@fb.com>
date Wed, 18 Mar 2015 15:59:45 -0700
parents 216fa1ba9993
children d0ea2028e8e6
files mercurial/manifest.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Thu Mar 19 17:40:19 2015 +0100
+++ b/mercurial/manifest.py	Wed Mar 18 15:59:45 2015 -0700
@@ -164,8 +164,8 @@
             return self.copy()
 
         files = match.files()
-        if ((match.matchfn == match.exact and len(files) < 100) or
-            (not match.anypats() and util.all(fn in self for fn in files))):
+        if (len(files) < 100 and (match.matchfn == match.exact or
+            (not match.anypats() and util.all(fn in self for fn in files)))):
             return self.intersectfiles(files)
 
         lm = manifestdict('')