*sigh* That will teach me, eh? I should have run it with it not printing to STDERR and that piped to /dev/null =)

Also, in my defense, it was after my bedtime =) Don't apologize for being sharp...

What is worse it that I tested a working version of the for_index_substr but "cleaned it up" for the final run.

I normally use vars ... to avoid the scope issue. =( *woe is me*

OTOH, I don't get your numbers when running your code. Number one, your results check should be:

foreach (@result) { print "bad!" unless ($_->{REx} eq $_->{split} and $_->{split} eq $_->{index}); }

Those arrows are important. Second, the comparison will always fail because your regex includes the terminal space and the split version doesn't. Also, if there were multiple spaces or other types of whitespace they would fail but we both agreed to ignore that. =)

Third, I still get equivalent results, (split_join_2 has the non-magical /\s+/ regex, just for fun. I get this with cmpthese 20,000. (using cmpthese -10 gives the equivalent results.)

                   Rate split_join_2   split_join        regexp for_index_substr
split_join_2     3205/s           --          -0%           -4%              -6%
split_join       3205/s           0%           --           -4%              -6%
regexp           3344/s           4%           4%            --              -2%
for_index_substr 3413/s           6%           6%            2%               --

Worse, the array slice hack on the end of (split...)[0..29] throws warnings on -w if there are too few items in the slice to join. Join doesn't like undef it appears =)

All in all, I'm now less enlightened now. Did I cut-n-paste wrong? I print debugged to verify that bits were working all thru it. *sigh*

--
$you = new YOU;
honk() if $you->love(perl)


In reply to RE: (dchetlin: Benchmark fixes) 30 Spaces- 1 question by extremely
in thread 30 Spaces- 1 question by AgentM

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.