[PLUG] Binary compiled Perl code?
Phil Tomson
ptkwt at aracnet.com
Fri Oct 4 17:24:50 UTC 2002
On Fri, 4 Oct 2002, Alex Daniloff wrote:
> Hello Linux folkz,
> I want to convert my Perl code into
> compiled Linux executable binary file.
> Generally I need to do this to speed up
> my program by skipping interpretation and
> compilation phase when it's executed.
> Could somebody please advise where should
> I look for the information on this subject.
> Or should I convert my Perl script into C/C++
> and compile it?
> What is the better approach to achieve this goal?
> Thank you in advance for any advise or sources of
> information.
>
There was some kind of perl2exe tool that used to be advertised in he Perl
Journal as I recall...
But first consider:
If your Perl script is mostly doing text processing (which is common
for Perl scripts) then it's not likely that you'll speed it up much at all
by converting to C++ and compiling. Perl's regex engine is highly
optimized already.
Perhaps you should figure out which parts of the script might be sped up
by moving to C and rewrite only those parts and create an extension that
is callable from C (Use the Inline::C module for this). For example, if
you're doing some kind of matrix
multiplication (something that you _could_ speed up in C) Inline::C let's
you insert the C code for doing this into your Perl code. It takes care
of compiling and creating an extenstion from the C code.
So it's likely that you won't be able to speed up things too much by
moving to C/C++ (in the case of text processing), but for other cases
where things can be sped up in C try using the Inline::C module to rewrite
those parts instead of rewriting everything in C/C++.
Phil
More information about the PLUG
mailing list