SRE vs PRE: speed

Oleg Broytmann phd at phd.fep.ru
Sat Jul 7 03:48:17 EDT 2001


Hello. Thank you for response.

On Fri, 6 Jul 2001, Fredrik Lundh wrote:
> Oleg Broytmann wrote:
> > My company doen't want to switch from python 1.5.2 to 2.0+ - our CTO is
> > very disappointed with SRE speed. SRE is 3-4 times lsower.
>
> > Any plans to make it faster?
>
> sure.

   Nice!

> but the priority this far has been "match" and "search", not
> "sub".  change your benchmark to use "search" or "findall",
> and you'll find that SRE is 5-10 times faster than PRE.

   Ok, we'll see.

> and you can easily make your code faster without having
> to wait for an upgrade: just use the string.replace function
> instead.  it's about 15 times faster than PRE on this one...
> (25 times faster if you use unicode strings ;-)

   It is not that easy. We really use re in our programs, and what is more,
we use other libraries that use re heavily (mxDateTime, for example). Our
programs are much slower with Python 2.0 comparing to 1.5.2, and profiling
revealed it is due to re.

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list