Unfortunately, I don't have your shiny Benchmark::Sized (I'm looking forward to its release), but there are my results using Benchmark::cmpthese:

2;130 juerd@ouranos:~/modje/Blah/Acme/Tie/Handle/Blah/Acme-Tie-Handle- +Blah--0.10$ perl -MBenchmark=cmpthese -e'$_="fooooo"; cmpthese(-1, {r +e => sub {$a = !/^\.\.?\z/}, ne => sub { $a = ($_ ne "." and $_ ne ". +."); }})' Benchmark: running ne, re, each for at least 1 CPU seconds... ne: 1 wallclock secs ( 1.02 usr + -0.01 sys = 1.01 CPU) @ 12 +18808.91/s (n=1230997) re: 1 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU) @ 18 +03743.12/s (n=1966080) Rate ne re ne 1218809/s -- -32% re 1803743/s 48% --
Maybe this is because you used \Z, which is equivalent to $ if /s is not used. \z should be used (explained elsewhere in this thread).
2;0 juerd@ouranos:~/modje/Blah/Acme/Tie/Handle/Blah/Acme-Tie-Handle-Bl +ah--0.10$ perl -MBenchmark=cmpthese -e'$_="foo"; cmpthese(-0.3, { z = +> sub { /o\z/ }, Z => sub { /o\Z/ } });' Benchmark: running Z, z, each for at least 0.3 CPU seconds... Z: 2 wallclock secs ( 0.43 usr + 0.02 sys = 0.45 CPU) @ 36 +70015.56/s (n=1651507) z: 1 wallclock secs ( 0.44 usr + -0.01 sys = 0.43 CPU) @ 44 +19869.77/s (n=1900544) Rate Z z Z 3670016/s -- -17% z 4419870/s 20% --

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.


In reply to Re: Re: Create a list of directories without . and .. by Juerd
in thread Create a list of directories without . and .. by BrowserUk

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, details, 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, summary, 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.