Best way to reduce perl startup time

I have been working on the Perl parser for several years, although since it was always pre-alpha, I never worried about speeding it up. However, I began to work on how to optimize it, and was surprised at what I found.

After some algorithmic and regular optimizations, normal execution takes about 3.5 seconds, of which about 2.3 is the time it takes to start Perl (which I measured with "time perl scriptname.pl" after installing "die (" Done ")," on the first line. "I understand that Regexp :: Grammars is not the fastest Perl module, but it seems that it takes much longer to initialize it than executing the script.

So I started learning a simple way to compile it to bytecode before running it. It seems B :: Bytecode, the only functional way to do this, is no longer supported or included in the main Perl distribution. Is there an easy way to reduce startup time?

Thanks!

+4
source share
1 answer

There are ways to run persistent scripts. They are usually used in the context of a web server, but there is no reason not to use them for other purposes.

One such CGI :: SpeedyCGI system , which may or may not be what I was thinking. Currently, it is also known as PersistentPerl .

+1
source

All Articles