This is perl, v5.6.0 built for i686-linux

Built this version myself on a Linux 2.2.17 box.

UPDATED:
OK I have a new 5.6.0 build at home, on the old pentium 166 This is perl, v5.6.0 built for i586-linux That produces these results with your script, no changes, 'cept I whacked the check off the end.

                  Rate for_index_substr           regexp       split_join
for_index_substr 395/s               --             -24%             -24%
regexp           518/s              31%               --              -0%
split_join       520/s              32%               0%               --

Bet on us looking at different optimizations for processor and platform and compiler.

IMHO, the regex or the index should usually win. The split_join one creates a whole array and then reloops over it to create a new string. the regex just matches along it and then internally $1 is a substr created by the match, you just link a real name to the SV* record. Index should beat a regex and the overhead of creating an inner loop manually and following it shouldn't be that bad, and substr is real fast. =) Your test surprised me cause regex won by so much. This newest one makes no sense.

If all the results turn out to be valid, what are the platform differences, really?

Another box, 5.004_04 i386-linux (oh man does this need an overhaul?) gives me 13sec@regex, 16sec@split, 18.5sec@index. I'm just making this worse, aren't I?

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


In reply to RE: RE: 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.