Perl Vs Python

A.M. Kuchling amk at amk.ca
Thu Feb 27 14:59:27 EST 2003


On Thu, 27 Feb 2003 20:17:11 +0200, 
	Bo M. Maryniuck <b.maryniuk at forbis.lt> wrote:
> 	Problem is that regexp in Python is much slower than in Perl. 

When I timed a simple pattern (abc.*def) on a 10000-character, Python
matches in ~7000 usec and Perl in ~8000 usec, but that proves nothing. I've
never seen a benchmark suite for regexes that made it possible to compare
two different regex implementations in any sensible way.  

> And optimising Python regexps is only in one way: "Don't do this".

Huh?  Writing a sensible regex pattern that doesn't backtrack too much
requires the same set of skills no matter what the host language is.

--amk                                                    (www.amk.ca)
HORATIO: Now cracks a noble heart.
      -- _Hamlet_, V, ii




More information about the Python-list mailing list