# HG changeset patch # User Matt Mackall # Date 2015-03-18 18:37:18 # Node ID 7002ad149f30a363456065b604b811741c132154 # Parent 389693a245fa399abbd993f0ebc12bd3be75b411 manifest: speed up matches for large sets of files If the number of files being matched is large, the bisection overhead can dominate, which caused a performance regression for revert --all and histedit. This introduces a (fairly arbitrary) cross-over from using bisections to bulk search. diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -164,7 +164,7 @@ class manifestdict(object): return self.copy() files = match.files() - if (match.matchfn == match.exact or + if ((match.matchfn == match.exact and len(files) < 100) or (not match.anypats() and util.all(fn in self for fn in files))): return self.intersectfiles(files)