[Python-Dev] Speeding up regular expression compilation
Martin v. Löwis
martin at v.loewis.de
Thu Oct 30 17:16:48 EST 2003
Bram Moolenaar <Bram at moolenaar.net> writes:
> Is there a trick to make compiling patterns go faster?
If you compile the same regular expression at every program startup,
and want to reduce the time for that, you can cPickle the compile
expression, and restore it from the string. If that fails (because the
format of compiled expressions has failed), you should fall back to
compiling expressions, and optionally save the new version.
Regards,
Martin
More information about the Python-Dev
mailing list