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

Hmm, that was dumb of me. But as you point out, as long as we know it's working, the comparison is unnecessary anyways.

I'm much more intrigued that you're getting different results than I am. What version of Perl are you running?

[~] $ perl -v This is perl, v5.6.0 built for i686-linux (with 1 registered patch, see perl -V for more detail) Copyright 1987-2000, Larry Wall Binary build 618 provided by ActiveState Tool Corp. http://www.ActiveS +tate.com Built 04:53:25 Sep 14 2000

Update: Hmm. I can't get any consistency out of this benchmark. Out of the various machines I tried it on, the REx solution is about half of the time way ahead of the pack, and the other half they're all about the same. Weird. Eerie.

-dlc

Replies are listed 'Best First'.
RE: RE: RE: (dchetlin: Benchmark fixes) 30 Spaces- 1 question
by extremely (Priest) on Oct 10, 2000 at 08:39 UTC

    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)