[patch] syntax:plain for .hgignore
Guido Ostkamp
hg at ostkamp.fastmail.fm
Fri Sep 14 12:28:54 CDT 2007
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.
Regards
Guido
More information about the Mercurial-devel
mailing list