Re: Regex speed
From: A.M. Kuchling (amk_at_amk.ca)
Date: 10/29/04
- Next message: Josiah Carlson: "Re: Real-time graphs"
- Previous message: F. GEIGER: "[wxPython] How to rebuild a page containing controls because some of them have to be deleted?"
- In reply to: Reinhold Birkenfeld: "Re: Regex speed"
- Next in thread: Andrew Dalke: "Re: Regex speed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Oct 2004 13:51:16 -0500
On Fri, 29 Oct 2004 20:35:28 +0200,
Reinhold Birkenfeld <reinhold-birkenfeld-nospam@wolke7.net> wrote:
> But my actual question is why Perl can run the same regexes in what
> seems no time at all.
Probably Perl's engine does some particular bit of optimization that
Python's engine isn't doing. I have no idea what optimization that might
be.
> But /usr/lib/python2.3/sre*.py are relatively large for that; what's in
> there?
That code is the compiler that turns expressions into the bytecode that the
regex engine runs. Having it be in Python only matters to the performance
of re.compile(), and that function usually isn't a bottleneck.
> You're right again. Is the pre module using the PCRE C library?
An extensively hacked version of it. Modules/pypcre.c contains the bulk of
it; pcremodule.c is the Python interface to it.
--amk
- Next message: Josiah Carlson: "Re: Real-time graphs"
- Previous message: F. GEIGER: "[wxPython] How to rebuild a page containing controls because some of them have to be deleted?"
- In reply to: Reinhold Birkenfeld: "Re: Regex speed"
- Next in thread: Andrew Dalke: "Re: Regex speed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|