How can I compile my Perl script to reduce startup time?

Is there a way to save a compiled version of perl scripts?

Or a way to do a JavaScript style compilation where you just remove comments, spaces, etc.

+2
compiler-construction perl
Oct 11 2018-10-10
source share
6 answers

You are trying to optimize in the wrong place. If you use scripts in the web / cgi environment, there is no need to accept compilation every time the script is executed. Scripts must be run continuously, which you can do with Apache mod / perl, FastCGI, or several new technologies and frameworks such as Plack and Catalyst. If you are more specific about your needs, you will find that there are several options available to you.

+5
11 Oct 2018-10-11
source share

Do you realize that Javascript is minimized to save bandwidth rather than run time or runtime? And that practice of minimizing Javascript began in the days of dial-up connections?

Of course, there was a time when interpreted programs were often called that way, but then the typical processors were Z80 and 8086, operating at 4-8 MHz, and using cycle loads to execute one command. To show: my Athlon XP-M 2400 is ~ 10,000 times faster than my 8MHz 8086 for processor related programs.

+2
Oct 11 2018-10-11
source share

You can use PPI to highlight comments and PODs.

+1
Oct 11 2018-10-10
source share

Perl :: Squish is the "minifier" you are looking for. Caution: This will not help you at all. You are trying to optimize at the wrong end.

+1
11 Oct 2018-10-10
source share

Try the perl compiler, CB :: C or B :: Bytecode (similar to python pyc).

http://search.cpan.org/dist/BC/perlcompile.pod

+1
Nov 22 2018-10-22T00:
source share

If you do this for fun, you can check parrot vm

If not .. see my comment;)

-2
Oct 11 2018-10-11
source share



All Articles