Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Over the past month, there've been at least two separate meditations on whether Perl is more (or less) efficient than other languages. C/C++ seem to be the most common comparison, with Java a close second. Yet, I'm noticing that very few people are talking about what "efficient" means. I see that there is more than one "efficiency" measure.
  1. CPU-efficient: executing statements faster
  2. RAM-efficient: taking less RAM for the same stuff
  3. development-efficient: taking less programmer time to write a program to accomplish the same task
  4. maintainence-efficient: given a program that is already written, modify it to accomplish a new task
Having my primary experience with C/C++, Perl, and BASIC (especially Excel's VBA), I'll only speak to those three languages. Also, I'm going to assume a decent professional programmer, but not a guru-level expert.

C/C++ is faster in terms of CPU. Why? Because C is Perl's machine language. Perl is tokenized to some assembler (soon-to-be Parrot), then each token is converted to some "machine language" which is implemented in (extremely optimized) C. If equally-optimized C is used without the Perl tokenization, it will necessarily be faster. Plus, C's data structures aren't stuffed with Perl's information-tracking additions.

So, C/C++ is more efficient in terms of the computer.

Writing a program in Perl, however, is generally quicker - in terms of programmer time - than in C/C++. I have a richer set of nouns (primitives) and verbs (operations) than in C/C++. More complex operations are supported in the language and there are operations in Perl than would require hundreds of lines in C/C++ to accomplish. This is especially true in string processing.

In addition, because C programs tend to be more complex than Perl programs, maintenance on them is more complex and error-prone. A 500 line Perl program is often equivalent to a 2500 line C/C++ program. That's five times the places an error can be hiding and five times the places you can inadvertantly add an error. I'm not keen on working with that kind of situation.

So, Perl is more efficient in terms of the developer.

Unless you need the computer efficiencies, I'd go with Perl.

(The astute observer notes that I didn't mention VBA. That's cause it's more of a fungus and not a computer language.)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.


In reply to What does "efficient" mean?!? by dragonchild

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (7)
    As of 2020-12-03 14:39 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      How often do you use taint mode?





      Results (56 votes). Check out past polls.

      Notices?