use strict; use warnings; use Benchmark 'cmpthese'; cmpthese -1, { map { $_ => \&$_ } 'a' .. 'g' }; sub a {eval 1 for 0 .. 999} {use feature ':5.10'; sub b {eval 1 for 0 .. 999}} {use 5.010; sub c {eval 1 for 0 .. 999}} {no feature ':all'; use feature ':5.10'; sub d {eval 1 for 0 .. 999}} {use feature 'say'; sub e {eval 1 for 0 .. 999}} { no feature 'say'; sub f {eval 1 for 0 .. 999}} {use feature 'say'; no feature 'say'; sub g {eval 1 for 0 .. 999}}

Results:

Rate d b e g f a c d 119/s -- -0% -18% -23% -25% -53% -53% b 119/s 0% -- -18% -23% -25% -53% -53% e 145/s 22% 22% -- -7% -8% -43% -43% g 155/s 30% 30% 7% -- -2% -38% -38% f 158/s 33% 33% 9% 2% -- -37% -37% a 252/s 112% 112% 74% 62% 59% -- -0% c 252/s 112% 112% 74% 63% 59% 0% --

Looks like feature pragma leaves some nasty attribute somewhere if mentioned. String eval is slow as it is already, why make it even slower. Well, partly tongue-in-cheek useless entertainment, but still partly: I used to declare like "c" case, then made a habit of explicitly declaring like e.g. "e"; now what? perfectionist in me urges to return to habits of years long gone. The "d" is there because feature says it should be exactly the same as "c".


In reply to A plague on all your features by Anonymous Monk

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.