re.match() performance
Diez B. Roggisch
deets at nospam.web.de
Thu Dec 18 09:16:02 EST 2008
Emanuele D'Arrigo wrote:
> Sorry for the previous post, hit the Enter button by mistake... here's
> the complete one:
>
> Hi everybody!
>
> I've written the code below to test the differences in performance
> between compiled and non-compiled regular expression matching but I
> don't quite understand the results. It appears that the compiled the
> pattern only takes 2% less time to process the match. Is there some
> caching going on in the uncompiled section that prevents me from
> noticing its otherwise lower speed?
Yes. There is even a purge-function to clear that cache, for whatever
reason.
To answer that question yourself, you could have taken a look into the
python library, it's not as scary as you might think :)
Diez
More information about the Python-list
mailing list