Hmm.. Redefining makes a significant difference. That is odd, I didn't beleive that any of those functions where modifying the list. Which one is modifying the list?

C:\test>perl 429768.pl (warning: too few iterations for a reliable count) Rate Grep Grep + Map Hash Map Router Trinary Origi +nal Switch Grep 9699/s -- -36% -39% -42% -44% -47% - +52% -65% Grep + Map 15244/s 57% -- -5% -9% -12% -17% - +24% -45% Hash 16000/s 65% 5% -- -5% -8% -12% - +20% -43% Map 16835/s 74% 10% 5% -- -3% -8% - +16% -40% Router 17301/s 78% 13% 8% 3% -- -5% - +13% -38% Trinary 18282/s 88% 20% 14% 9% 6% -- +-9% -34% Original 20000/s 106% 31% 25% 19% 16% 9% + -- -28% Switch 27855/s 187% 83% 74% 65% 61% 52% +39% -- C:\test>perl 429768.pl Rate Grep Grep + Map Map Hash Router Trinary Origi +nal Switch Grep 9625/s -- -38% -41% -41% -45% -47% - +53% -66% Grep + Map 15420/s 60% -- -5% -5% -12% -16% - +25% -46% Map 16194/s 68% 5% -- -0% -8% -11% - +22% -43% Hash 16194/s 68% 5% 0% -- -8% -11% - +22% -43% Router 17544/s 82% 14% 8% 8% -- -4% - +15% -38% Trinary 18282/s 90% 19% 13% 13% 4% -- - +11% -36% Original 20640/s 114% 34% 27% 27% 18% 13% + -- -27% Switch 28450/s 196% 84% 76% 76% 62% 56% +38% --

___________
Eric Hodges

In reply to Re^4: Can this code be optimized further? by eric256
in thread Can this code be optimized further? by samy_kumar

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.