UPDATE: I've been unclear. Allow me to try again: As I understand it, Perl must be interpretted, rendered as bytecode, and executed. The question is this: how good is that bytecode, and similar/different is it from a compiled binary?

I am asking because if the bytecode generated is good, why can't we distribute the bytecode rather than the source - skipping a run-time step and improving the performance along the way?

This is sounding more and more like a FAQ.

Check out:

perldoc -q compile

Particularly the second item, in perlfaq3;

Key quote:

In general, the compiler will do nothing to make a Perl program smaller, faster, more portable, or more secure. In fact, it can make your situation worse. The executable will be bigger, your VM system may take longer to load the whole thing, the binary is fragile and hard to fix, and compilation never stopped software piracy in the form of crackers, viruses, or bootleggers. The real advantage of the compiler is merely packaging, and once you see the size of what it makes (well, unless you use a shared libperl.so), you'll probably want a complete Perl install anyway.

It is worth noteing that perl6 should minimize many of those issues. My understanding is that the parrot VM executes byte code, and doesn't care whether it comes directly from the perl parser or a saved file. In that way it becomes more like Java. As long as a virtual machine is available, pre-parsed (compiled) scripts will run on it. Perl5 doesn't have a separate virtual machine for each OS, (well, it does but it is closely tied to the parser for each platform,) so the output from the parser is tailored to run on a platform specific VM; a portability nightmare.


In reply to Re: High Performance Perl by thundergnat
in thread High Performance Perl by willyyam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.