Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

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

Generally speaking the GRT is a signifigant improvement on the ST

But it doesn't seem te be an improvement with your example sort:

Benchmark: running bare, grt, st for at least 3 CPU seconds... bare: 6 wallclock secs ( 3.08 usr + 0.01 sys = 3.09 CPU) @ 12 +79584.47/s (n=3953916) grt: 8 wallclock secs ( 3.11 usr + 0.00 sys = 3.11 CPU) @ 11 +18145.66/s (n=3477433) st: 7 wallclock secs ( 3.05 usr + 0.01 sys = 3.06 CPU) @ 11 +46781.05/s (n=3509150) Rate grt st bare grt 1118146/s -- -2% -13% st 1146781/s 3% -- -10% bare 1279584/s 14% 12% --

#!/usr/bin/perl -w use strict; use Benchmark qw(cmpthese); my @words = qw(The time has come the Walrus said to speak of many thin +gs); cmpthese(-3, { st => q{ my @sorted = map { $_->[1] } sort { $a->[0] <=> $a->[0] || $a->[1] cmp $b->[1] } map { [ tr/eE/eE/, $_ ] } @words; }, grt => q{ my @sorted = map { substr($_, 4) } sort map { pack("LA*", tr/eE/eE/, $_) } @words; }, bare => q{ my @sorted = sort { ($a =~ tr/eE/eE/) <=> ($b =~ tr/eE/eE/) } +@words; } });
This is perl, v5.8.0 built for i686-linux

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


In reply to Re: Advanced Sorting - GRT - Guttman Rosler Transform by Juerd
in thread Advanced Sorting - GRT - Guttman Rosler Transform by demerphq

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 taking refuge in the Monastery: (16)
    As of 2014-12-19 08:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (75 votes), past polls