Originally when I wrote perl (perl5.4.4 on the IBM RS/6000 AIX Unix) code in the '90s, my interest in perl was to prototype the application and then rewrite it in C. If you look at your sample, you are doing the same! As I have discovered, perl is more than C. Today, I don't use perl to prototype, but use it to develop full projects in less time and with more functionality. ( and usually much faster both in my time and in CPU cycles ).

Until 2002-3, I never used a hash (and your sample doesn't either). My last large project used 20,000+ lines of actually code plus comments, and maintained sub-second response time consistently with as many as 400 users logged into the system. (Note: I can't image how long it would have taken to do that project in C. ) The code is full of hashes that improve performance.
Let perl do the look up!

In the '80s I wrote a wordprocessor to emulate WordPerfect for law office professionals. It was written in C, and as each new operating system/hardware computer emerged, I would rewrite it to get it to work. After a while it was getting less and less portable. Finally, I bit the bullet, and rewrote it in perl. It took about 6 months and I learned about functionality in perl that I had been missing. To my amazement it was faster than the C version. Certain text features were faster in perl than in C. If I had to edit a 8_000_000 line log file, I didn't have to consider the software/hardware architecture, just let perl handle it. By moving from perl5.6.1 to perl5.8.8, it was faster again. So far the fasted perl I have used is 5.12.2, but that is because I'm writing code in perl and not C-like.

Since you are in a learning and/or relearning cycle with perl, look into the full perl solution, not what was available with perl5.6.1, but what perlish solutions are better today. I'm confident that you'll like and respect the "modern perl".

Thank you

"Well done is better than well said." - Benjamin Franklin


In reply to Re: Why "Modern Perl" is slower than "Legacy Perl"? by flexvault
in thread Why "Modern Perl" is slower than "Legacy Perl"? by dwalin

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.