Submitter | Bryan O'Sullivan |
---|---|
Date | March 11, 2013, 7:11 p.m. |
Message ID | <15e77967d1b3bb5eb9df.1363029069@australite.local> |
Download | mbox | patch |
Permalink | /patch/1108/ |
State | Accepted, archived |
Headers | show |
Comments
LGTM On Mar 11, 2013, at 2:11 PM, Bryan O'Sullivan <bos@serpentine.com> wrote: > # HG changeset patch > # User Bryan O'Sullivan <bryano@fb.com> > # Date 1363028853 25200 > # Node ID 15e77967d1b3bb5eb9dfb6e7bfe94691d280af74 > # Parent c6945de2450811e4d7240f1e083eaea26d81bd2b > grep: use re2 if possible > > Since re2 is enormously faster than Python's re module, this should > help performance, ceteris paribus. grep currently has other huge > performance problems that mask any gain :-( > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -2960,7 +2960,7 @@ def grep(ui, repo, pattern, *pats, **opt > if opts.get('ignore_case'): > reflags |= re.I > try: > - regexp = re.compile(pattern, reflags) > + regexp = util.compilere(pattern, reflags) > except re.error, inst: > ui.warn(_("grep: invalid match pattern: %s\n") % inst) > return 1 > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Looks good to me.
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2960,7 +2960,7 @@ def grep(ui, repo, pattern, *pats, **opt if opts.get('ignore_case'): reflags |= re.I try: - regexp = re.compile(pattern, reflags) + regexp = util.compilere(pattern, reflags) except re.error, inst: ui.warn(_("grep: invalid match pattern: %s\n") % inst) return 1