From: akuchlin at cnri.reston.va.us (Andrew M. Kuchling)
Date: Mon, 26 Apr 1999 11:11:14 -0400 (EDT)
Subject: Python too slow for real world
In-Reply-To: <Pine.SUN.3.95-heb-2.07.990426013235.1500B-100000@sunset.ma.huji.ac.il>
References: <372068E6.16A4A90@icrf.icnet.uk>
	<3720A21B.9C62DDB9@icrf.icnet.uk>
	<3720C4DB.7FCF2AE@appliedbiometrics.com>
	<3720C6EE.33CA6494@appliedbiometrics.com>
	<y0jaevznhha.fsf@vier.idi.ntnu.no>
	<glmvhemn4zx.fsf@caffeine.mitre.org>
	<y0j7lr0obcs.fsf@vier.idi.ntnu.no>
	<Pine.SUN.3.95-heb-2.07.990426013235.1500B-100000@sunset.ma.huji.ac.il>
Message-ID: <14116.27076.739392.393714@amarok.cnri.reston.va.us>
Content-Length: 1588
X-UID: 1607                                                  

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"





