Python too slow for real world

Andrew M. Kuchling akuchlin at cnri.reston.va.us
Mon Apr 26 11:11:14 EDT 1999


Moshe Zadka writes:
>2. re.py is a (very thin) wrapper around pcre, a C extension module for
>Perl Compatible Regular Expressions.
>
>Which just goes to say that while pcre can certainly be optimized, it
>can't be done by simply rewriting it in C.

	Things like search-and-replace, though, take substantial hits
from being implemented in Python code; rewriting re.py in C is one of
the top items on my TODO list for the regex code.  

	I also want some sort of code generation interface so that
custom syntaxes can be implemented.  The problem there is how to do it
safely so that it's not possible to crash the interpreter by
generating buggy expressions.  (We'd want the re module usable by code
in a restricted execution environment, after all.)

>but-we-can-always-call-Perl-on-the-fly-to-evaluate-regular-expression-ly
>y'rs,

In one early experiment, there was a version of the regex module that
used Perl's pregcomp() and pregexec() functions.  It worked fine in
some admittedly limited testing, but the compiled module was something
like 500K because the regex code pulled in the rest of Perl.  I
couldn't figure out how to extract the regex code to fix this, so that
experiment came to a quick end.  Pity, really.

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
You see, you're all wrong. My name isn't Brain Eater. I am the Head. And I
don't simply eat brains. It's something deeper than that. Something magical.
Something transubstantiational. Excuse me one moment while I ... <shlurppp>
    -- The first villain, in ENIGMA #1: "The Lizard, The Head, The Enigma"





More information about the Python-list mailing list