Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(tye)Re2: What would you do? (benchmarks...)

by tye (Sage)
on Mar 17, 2001 at 03:33 UTC ( [id://65069]=note: print w/replies, xml ) Need Help??


in reply to Re: What would you do? (benchmarks...)
in thread What would you do?

I modified "evilgrep" to use (@list/2) instead of @list since the whole purpose of these benchmarks was obviously to make me look stupid. ;)

Rate evilgrep slice modulo grep c_style doubler evilgrep 4708/s -- -16% -20% -20% -45% -54% slice 5584/s 19% -- -5% -5% -34% -46% modulo 5865/s 25% 5% -- -0% -31% -43% grep 5893/s 25% 6% 0% -- -31% -43% c_style 8524/s 81% 53% 45% 45% -- -17% doubler 10320/s 119% 85% 76% 75% 21% --
So I just wanted to note that I'm now in third place instead of last and that I did this with my wimpy office machine instead of my kick-arse home machine or my runs/second would have been much higher than yours as well! q-:

        - tye (but my friends don't call me)

Replies are listed 'Best First'.
Re: (tye)Re2: What would you do? (benchmarks...)
by MeowChow (Vicar) on Mar 17, 2001 at 04:08 UTC
    Well, I'm honor-bound to reply that your seeming algorithmic superiority is directly attributable to your pernicious use of bitwise operations. You also have a subtle precedence bug in evilgrep that is fixed in the code below, and invalidates all your results. Furthermore, all your benchmarks are belong to me:
    use Benchmark qw(cmpthese); my @list = (0..100); cmpthese (-3, { c_style => sub { for (my $i = 0; $i <= $#list; $i += 2) {$list[$i] += 'h1' } }, slice => sub { $_ = 'h2' for @list[map {$_ << 1} 0..$#list/2] }, modulo => sub { $_ & 1 or $list[$_] = 'h3' for 0..$#list }, doubler => sub { $list[$_ << 1] = 'h4' for 0..@list/2 }, evilgrep => sub { @list[grep{!($_&1)}0..$#list]= ('h5')x @list }, grep => sub { @list[grep{!($_&1)}0..$#list]= ('h6')x(@list/2 + 1 +) } }); ### RESULTS ### evilgrep 7467/s -- -19% -40% -42% -43% -65% grep 9244/s 24% -- -25% -28% -30% -57% c_style 12398/s 66% 34% -- -3% -6% -42% modulo 12811/s 72% 39% 3% -- -3% -40% slice 13211/s 77% 43% 7% 3% -- -38% doubler 21289/s 185% 130% 72% 66% 61% --
    ps. My system is currently underclocked, not to mention having slow timings, 4-way interleaving, and CAS2 disabled. If and when I reboot and tweak, I welcome you to bring it! :P

    pps. Assuming of course, my computer boots up...

       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print

      Well, at least you succeeded at making me look stupid this time. ;)

      For great justice!

              - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://65069]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-20 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found