Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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 => '', plp_site => '', 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

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2022-08-16 13:23 GMT
Find Nodes?
    Voting Booth?

    No recent polls found