Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
In general, 10% doesn't look significant to me for a Benchmark. It has been proven in the past that unless the difference is large, Benchmark results aren't well reproducable from platform to platform. Even changing the compiler with which perl was compiled (and leaving everything else the same), could change the order of the outcome of a Benchmark. For instance, if I run your version of the Benchmark, with a lead string of 80 a's, the original ST appears to be slightly *faster*:
Benchmark: running Liz, ST for at least 5 CPU seconds... Liz: 5 wallclock secs ( 5.28 usr + 0.01 sys = 5.29 CPU) @ 99 +.05/s (n=524) ST: 5 wallclock secs ( 5.30 usr + 0.00 sys = 5.30 CPU) @ 10 +0.94/s (n=535) Rate Liz ST Liz 99.1/s -- -2% ST 101/s 2% --
Of course, if speed is a concern, you wouldn't use ST at all, you'd use GRT. Here's a benchmark with GRT included:
#!/usr/bin/perl use strict; use warnings; use Benchmark qw /cmpthese/; our @array = map {("a" x 80) . sprintf ":%03d" => $_} 0 .. 999; our (@a, @b, @c); for (my $i = @array; -- $i;) { my $j = rand ($i + 1); @array [$i, $j] = @array [$j, $i]; } cmpthese -5 => { ST => '@::a = map {$_ -> [0]} sort {$a -> [1] <=> $b -> [1]} map {[$_ => substr $_, 81]} @array', Liz => '@::b = map {${$_ -> [0]}} sort {$a -> [1] <=> $b -> [1]} map {[\$_ => substr $_, 81]} @array', GRT => '@::c = map {substr ($_, 4) . ":" . substr ($_, 0, 3)} sort map {substr ($_, 81) . ":" . substr ($_, 0, 80)} @ +array' }; foreach my $i (0 .. 999) { die unless $a [$i] eq $b [$i] && $a [$i] eq $c [$i] } __END__ Benchmark: running GRT, Liz, ST for at least 5 CPU seconds... GRT: 5 wallclock secs ( 5.33 usr + 0.00 sys = 5.33 CPU) @ 19 +8.87/s (n=1060) Liz: 5 wallclock secs ( 5.31 usr + 0.00 sys = 5.31 CPU) @ 98 +.87/s (n=525) ST: 6 wallclock secs ( 5.31 usr + 0.01 sys = 5.32 CPU) @ 10 +0.38/s (n=534) Rate Liz ST GRT Liz 98.9/s -- -2% -50% ST 100/s 2% -- -50% GRT 199/s 101% 98% --

Abigail


In reply to Re: ${Schwartzian transform} ? by Abigail-II
in thread ${Schwartzian transform} ? by liz

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (8)
    As of 2014-09-23 05:17 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (210 votes), past polls