[Python-bugs-list] [ python-Bugs-515434 ] Very slow performance

noreply@sourceforge.net noreply@sourceforge.net
Tue, 19 Mar 2002 07:53:56 -0800


Bugs item #515434, was opened at 2002-02-09 23:54
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=515434&group_id=5470

Category: Regular Expressions
Group: Not a Bug
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Andy Miller (ajmiller)
Assigned to: Fredrik Lundh (effbot)
Summary: Very slow performance

Initial Comment:
While performance testing the RE module came across a 
case where it runs very slow (processing 4 or 5 lines 
of text per second on a P700 !!)

See the attached program for details

----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2002-03-19 10:53

Message:
Logged In: YES 
user_id=11375

Marking as closed.

----------------------------------------------------------------------

Comment By: Andy Miller (ajmiller)
Date: 2002-02-10 15:13

Message:
Logged In: YES 
user_id=447946

I certainly agree that regular expressions can be fine 
tuned and some run faster than others - unfortunately the 
case in point runs very fast in Perl (the problem was 
originally found when replacing some Perl functionality 
with Python !)

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2002-02-10 01:49

Message:
Logged In: YES 
user_id=31435

Patterns with highly ambiguous subpatterns (like your 
\w+.+\d+) may run extremely slowly in Python, or Perl, or 
any other language with a backtracking regexp engine.  See 
Friedl's "Mastering Regular Expressions" (O'Reilly) for an 
explanation.  You can learn how to write zippy regexps 
faster than fundamental consequences of the matching 
algorithm can be wished away <wink>.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=515434&group_id=5470