I totally agree.

I don't think that there is a reason to write in C nowadays except in embedded systems where real time speed is crucial.C was being used because its structures map closely to the hardware.

Perl uses references which disallow pointer arithmetic or pointer de-referencing which of course are slower in operation than pointers, but at the same time you don't get involved with allocating and de-allocating memory or playing directly with the hardware generating sigfaults easily.

Other issues that arise from C's non-restriction and flexibility are security oriented such as buffer overflows and string formatting and that is a reason why "plug-ins" libraries like The Safe C Library were designed to patch/correct.

Actually quoting the Safe C String Library overt security goals "The API should be capable of tracking whether strings are "trusted", a la Perl's taint mode.";even they recognize Perl's value!

This kind of quest for speed would us lead back to assembly which is faster than C. The question is would you like to deal with assembly? as C is a higher level that assembly, Perl is higher level than C.

It' more a question of what you want to TRADE for speed. The industry is constantly trading speed for flexibility and safety. That is why the trend is oriented on Virtual Machines like Java Virtual Machine or the .NET CLR which are layers on top of the OS and protect you from those kind of issues.

But if one wanted to find out what could be done to bring Perl closer to C he could take a look at Why Not Translate Perl to C? by Mark-Jason Dominus.


In reply to Re^2: compiling perl scripts aka why is perl not as fast as C by nikosv
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.