Patchwork manifest: avoid intersectfiles for matches > 100 files

login
register
mail settings
Submitter Durham Goode
Date March 18, 2015, 11:07 p.m.
Message ID <c22eaf00a52f752fc8a7.1426720046@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8154/
State Accepted
Commit 9e03602cd2d8b98e63344c0d9149d828caa93382
Headers show

Comments

Durham Goode - March 18, 2015, 11:07 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1426719585 25200
#      Wed Mar 18 15:59:45 2015 -0700
# Node ID c22eaf00a52f752fc8a776b822549de9f71495a9
# Parent  cdc4f3af2497b7342a8e4a081d2b07c9d888235a
manifest: avoid intersectfiles for matches > 100 files

Previously we only avoid manifest.intersectfiles for exact matches with less
than 100 files. We did not avoid it for non-exact matches. Let's just avoid
intersectfiles for all matches of > 100 files since the performance can be quite
rough with the new lazy manifest.
Augie Fackler - March 19, 2015, 1:24 p.m.
On Wed, Mar 18, 2015 at 04:07:26PM -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1426719585 25200
> #      Wed Mar 18 15:59:45 2015 -0700
> # Node ID c22eaf00a52f752fc8a776b822549de9f71495a9
> # Parent  cdc4f3af2497b7342a8e4a081d2b07c9d888235a
> manifest: avoid intersectfiles for matches > 100 files
>
> Previously we only avoid manifest.intersectfiles for exact matches with less
> than 100 files. We did not avoid it for non-exact matches. Let's just avoid
> intersectfiles for all matches of > 100 files since the performance can be quite
> rough with the new lazy manifest.

Seems reasonable. Do you have a particular command that I can mention
in the commit message when I queue it? I'd like to document things
like this so that we can start thinking about performance more
systematically soon.

>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -164,8 +164,8 @@ class manifestdict(object):
>              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('')
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -164,8 +164,8 @@  class manifestdict(object):
             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('')