Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Well, I'm honor-bound to reply that your seeming algorithmic superiority is directly attributable to your pernicious use of bitwise operations. You also have a subtle precedence bug in evilgrep that is fixed in the code below, and invalidates all your results. Furthermore, all your benchmarks are belong to me:
use Benchmark qw(cmpthese); my @list = (0..100); cmpthese (-3, { c_style => sub { for (my $i = 0; $i <= $#list; $i += 2) {$list[$i] += 'h1' } }, slice => sub { $_ = 'h2' for @list[map {$_ << 1} 0..$#list/2] }, modulo => sub { $_ & 1 or $list[$_] = 'h3' for 0..$#list }, doubler => sub { $list[$_ << 1] = 'h4' for 0..@list/2 }, evilgrep => sub { @list[grep{!($_&1)}0..$#list]= ('h5')x @list }, grep => sub { @list[grep{!($_&1)}0..$#list]= ('h6')x(@list/2 + 1 +) } }); ### RESULTS ### evilgrep 7467/s -- -19% -40% -42% -43% -65% grep 9244/s 24% -- -25% -28% -30% -57% c_style 12398/s 66% 34% -- -3% -6% -42% modulo 12811/s 72% 39% 3% -- -3% -40% slice 13211/s 77% 43% 7% 3% -- -38% doubler 21289/s 185% 130% 72% 66% 61% --
ps. My system is currently underclocked, not to mention having slow timings, 4-way interleaving, and CAS2 disabled. If and when I reboot and tweak, I welcome you to bring it! :P

pps. Assuming of course, my computer boots up...

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

In reply to Re: (tye)Re2: What would you do? (benchmarks...) by MeowChow
in thread What would you do? by MeowChow

Title:
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-25 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found