[patch] syntax:plain for .hgignore

Matt Mackall mpm at selenic.com
Fri Sep 14 17:40:07 UTC 2007


On Fri, Sep 14, 2007 at 07:28:54PM +0200, Guido Ostkamp wrote:
> On Fri, 14 Sep 2007, Johannes Hofmann wrote:
> >Just realized, that the culprit for the bad performance in our case is 
> >the '.*' that is added in front of each pattern by regex() in util.py. 
> >Using syntax:regexp and preceeding each fixed pattern with a '^' makes 
> >things fast.
> 
> And I just noticed that in util.py they are using
> 
>    re.compile(pat).match
> 
> instead of
> 
>    re.compile(pat).search
> 
> What we know from our Perl stuff is the 'search' behaviour. The 'match' 
> matches only from the beginning of a string, so acts like 
> '^rest_of_regexp'.
> 
> In this case they need to add '.*' in front of regexp for globs so this 
> gives '^.*rest_of_regexp' where a 'rest_of_regexp' with 'search' would be 
> fully sufficient and is probably better in terms of performance.
> 
> I'm wondering why 'match' is used here. Maybe Matt can give some insight.

The matching engine supports both rooted and unrooted regexes and
globs.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list