Yup, sure does. (*sigh* busted ;-) But it turns out a combination is slightly better as well. The modifier form of the for loop doesn't have the marginal overhead of scope (er I think...), although I wonder if the 3% gain is worth the obfu.

I have to admit that I was suprised to discover that the list assignment is so much faster than an array lookup (which obviously is why yours is faster). Somthing I shall keep in mind for the future.

Heres my benchmarks...

Benchmark: running demerphq, petral, petral_modifier, each for at leas +t 60 CPU seconds... demerphq: 66 wallclock secs (62.98 usr + 0.00 sys = 62.98 CPU) @ 21 +2.26/s (n=13369) petral: 64 wallclock secs (62.99 usr + 0.00 sys = 62.99 CPU) @ 26 +7.17/s (n=16828) petral_modifier: 64 wallclock secs (63.17 usr + 0.00 sys = 63.17 CPU) + @ 274.43/s (n=17336) Rate demerphq petral petral_modifier demerphq 212/s -- -21% -23% petral 267/s 26% -- -3% petral_modifier 274/s 29% 3% --

Yves / DeMerphq
--
When to use Prototypes?


In reply to Re: x 5 Array sort - kind of... (benchmark) by demerphq
in thread Array sort - kind of... by smitz

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.