Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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.)


In reply to Re: The Great Computer Language Shootout by Your Mother
in thread The Great Computer Language Shootout by yperl

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [Lady_Aleena]: So putting a nice DE or WM up on a Linux machine is not an option?
    [Discipulus]: i need some converter to have directly an OVF format directly: at the moment i'm trying with vmware converter standalone
    [Lady_Aleena]: I don't know what to tell you. I can barely get my Linux machine to do things I want.
    [Discipulus]: if DE or WM means desktop env and win manager.. no, not an option
    [Lady_Aleena]: That's what they mean, at least to me. 8)
    [Discipulus]: in the first attempt i failed, with an not usable v-machine.. ;=)
    [Discipulus]: but then discovered a registry trick to do before the physical2virtual migration
    [Lady_Aleena]: Sounds like a headache.

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (5)
    As of 2017-05-22 18:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?