At the very least compiling Perl to machine code as is done for C would preclude using string eval. But even if you accepted that as a reasonable limitation, Perl's type system and DWIMery mean that there is a degree of run time overhead that simply can't be removed. Altering Perl to remove that overhead would alter the language - it wouldn't be Perl any more and most of what would go would be exactly those elements that make it fast to develop in.

In fact for the core operations that Perl is tuned for (string and array manipulation) execution speed is generally quite acceptable. The trick is to code so that most of the work is done inside Perl constructs such as regular expressions, string functions and array manipulation functions.

Compilers for languages such as C++ use the information that strong typing provides to optimise code - often spending much more time in the optimisation phases than the basic compilation phases to achieve good results. Strong typing provides strong constraints on how code is written which allows optimisers to work well, but can really slow down code development. Writing the code becomes much more fussy!

At the end of the day you choose the language that best fits your skill set and is most applicable to the task at hand.


True laziness is hard work

In reply to Re: compiling perl scripts aka why is perl not as fast as C by GrandFather
in thread compiling perl scripts aka why is perl not as fast as C by punkish

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.