I just read an interesting article on Newsfactor.com. A student researcher made memory and time measurements for two different problems (text search and sieve of Eratosthenes) in four programming languages: C, Perl, Java, and Basic. Not surprisingly, the programs in C ran the fastest and used the least memory overall.

But I was surprised that in the relative rankings of the other languages, Perl was the second to most memory-efficient (in her terminology) for the text search problem, and most memory-efficient in the numeric problem, even beating out C. I had always believed the "common knowledge" that Perl used lots of memory, favoring memory use wherever it could gain in execution speed. The time efficiency numbers are not too shabby for Perl either, but the memory efficiency was a real surprise to me.

The article doesn't provide any code, and even the researcher admits she was not knowledgeable of programming when she started, so take the results with a grain of salt. Can anyone find the paper or code online? I couldn't (not lazily, anyway ;-) It was presented at this year's AAAS conference.


Given the recent inter-language flamage that's ocurred in the monastery, I want to add this clarification. My interest in the paper is not "My language wins, your language loses", but that a belief I'd held about Perl appears to be not borne out experimentally.


In reply to Efficiency comparisons by VSarkiss

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.