grep: use re2 if possible
authorBryan O'Sullivan <bryano@fb.com>
Mon, 11 Mar 2013 12:07:33 -0700
changeset 18776 87441497ecaa
parent 18775 5b05ceb24a8d
child 18777 8048c519dc6a
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 :-(
mercurial/commands.py
--- a/mercurial/commands.py	Mon Mar 11 12:06:13 2013 -0700
+++ b/mercurial/commands.py	Mon Mar 11 12:07:33 2013 -0700
@@ -2960,7 +2960,7 @@
     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