changeset 18776:87441497ecaa

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 :-(
author Bryan O'Sullivan <bryano@fb.com>
date Mon, 11 Mar 2013 12:07:33 -0700
parents 5b05ceb24a8d
children 8048c519dc6a
files mercurial/commands.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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