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

Comment on

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

Really? In my benchmarks, the XS versions are significantly faster. The List::Util XS version is faster than List::MoreUtils too.

use strict; use warnings; use Benchmark qw(cmpthese); use List::Util 1.35 (); BEGIN { *any_lu = *List::Util::any }; use List::MoreUtils (); BEGIN { *any_lmu = *List::MoreUtils::any }; sub any_pp (&@) { my $code = shift; &$code and return 1 for @_ ; () } { no warnings 'once'; @::LIST = (0..9); $::TARGET = 5; } cmpthese(-1, { any_lu => q[ any_lu { $_ eq $::TARGET } @::LIST ], any_lmu => q[ any_lmu { $_ eq $::TARGET } @::LIST ], any_pp => q[ any_pp { $_ eq $::TARGET } @::LIST ], }); __END__ Rate any_pp any_lmu any_lu any_pp 65761/s -- -79% -80% any_lmu 309688/s 371% -- -5% any_lu 324588/s 394% 5% --

For longer lists, the difference becomes more pronounced:

{ no warnings 'once'; @::LIST = (0..99); $::TARGET = 50; } ... __END__ Rate any_pp any_lmu any_lu any_pp 10195/s -- -84% -85% any_lmu 63999/s 528% -- -4% any_lu 66370/s 551% 4% --
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

In reply to Re^9: Smartmatch alternatives by tobyink
in thread Smartmatch alternatives by cavac

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, 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
  • 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (4)
    As of 2018-07-23 07:48 GMT
    Find Nodes?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

      Results (459 votes). Check out past polls.