[PLUG] Binary compiled Perl code?

Randal L. Schwartz merlyn at stonehenge.com
Mon Oct 7 23:28:51 UTC 2002


>>>>> "Alex" == Alex Daniloff <alex at daniloff.com> writes:

Alex> Hello Linux folkz,
Alex> I want to convert my Perl code into 
Alex> compiled Linux executable binary file.
Alex> Generally I need to do this to speed up
Alex> my program by skipping interpretation and
Alex> compilation phase when it's executed.
Alex> Could somebody please advise where should 
Alex> I look for the information on this subject.
Alex> Or should I convert my Perl script into C/C++
Alex> and compile it?
Alex> What is the better approach to achieve this goal?
Alex> Thank you in advance for any advise or sources of
Alex> information.

Put these as the last two lines of your program:

    BEGIN { warn sprintf "after compilation: %.2f %.2f\n", times }
    END { warn sprintf "after execution: %.2f %.2f\n", times }

That's the user/system cpu time (in seconds) after compilation and
after execution.

I bet if your program is of any significant size and purpose, the
compilation time will be a very small fraction of the execution time.
Now think of how much *human* time you'll be spending keeping a
"binary" up to date, and also realize that the time to load an
entirely separate unshared binary will probably be more than the time
for the already memory-paged-in Perl executable (on most systems :) to
simply read the source and compile it.

In short, Perl's compilation time is nearly always not the issue, once
you look at it.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



More information about the PLUG mailing list