[Python-ideas] re.compile_lazy - on first use compiled regexes

Oleg Broytman phd at phdru.name
Sat Mar 23 14:36:09 CET 2013


On Sat, Mar 23, 2013 at 01:38:19PM +0100, "M.-A. Lemburg" <mal at egenix.com> wrote:
> Wouldn't it make sense to add a way to pickle or marshal compiled REs ?
> 
> The precompiled REs could then be loaded directly from the
> pickle, avoiding the compiling overhead on startup.

   But with an overhead of opening files and unpickling. My wild guess
[not backed by numbers] is that it would be as slow.

   I suspect the only way to speedup things would be to precompile
regexps at compile (generating .pyc) time and saving compiled regexps in
the byte code file.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.



More information about the Python-ideas mailing list