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

Re: The Great Computer Language Shootout

by Your Mother (Chancellor)
on Sep 22, 2004 at 07:05 UTC ( #392857=note: print w/replies, xml ) Need Help??


in reply to The Great Computer Language Shootout

Others could poke better holes but here's my stab, assuming I'm using Benchmark correctly which I'm never sure about. Their random number generator perl versus perl's vanilla rand(). Off by between 200% and 1,500%.

use Benchmark qw(cmpthese); use strict; my $theirs = q# use constant IM => 139968; use constant IA => 3877; use constant IC => 29573; my $LAST = 42; sub gen_random { ($_[0] * ($LAST = ($LAST * IA + IC) % IM)) / IM } my $N = ($ARGV[0] || 100) - 1; gen_random(100.0) while ($N--); sprintf "%.9f\n", gen_random(100.0); #; my $native = q{rand(100) for 1 .. 100}; cmpthese(1_000_000, { theirs => $theirs, native => $native, }); __END__ Rate theirs native theirs 4414/s -- -68% native 13961/s 216% --

And if you turn it down to their default of a single run/generation:

Rate theirs native theirs 121507/s -- -93% native 1851852/s 1424% --

(Update: I know they're doing "the same algorithm" for each; just seems wrong to feed a cat dog food.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://392857]
help
Chatterbox?
[Discipulus]: good morning monks
[choroba]: Morning!
[Corion]: Hi choroba, Discipulus!
[Corion]: Yesterday I've been mulling over how to best generate HTTP requests from permutations of values but I haven't found a nice API for passing in the "template" of the HTTP request yet. I guess I'll have to do a SoPW for that

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2017-01-17 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (152 votes). Check out past polls.