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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
OK, let's not arbitrarily turn something into a function call that doesn't have to be, and, more importantly, let's recognize the overhead of loading a module:
use Benchmark qw(cmpthese); cmpthese(-2, { fs => sub { delete $INC{'File/Slurp.pm'}; require File::Slurp; + File::Slurp->import(); $x = read_file("foo") }, is => sub { $x = do { local (@ARGV, $/) = "foo"; <> }; } }); --- $ perl5.6.0 test.pl Benchmark: running fs, is, each for at least 2 CPU seconds... fs: 3 wallclock secs ( 2.08 usr + 0.11 sys = 2.19 CPU) @ 26 +6.67/s (n=584) is: 2 wallclock secs ( 1.16 usr + 0.86 sys = 2.02 CPU) @ 47 +311.39/s (n=95569) Rate fs is fs 267/s -- -99% is 47311/s 17642%
And, yes, I am being a little tongue in cheek with that... but the point is: benchmarks are what you make of them.
------------ :Wq Not an editor command: Wq

In reply to Re^2: use File::Slurp for (!"speed"); by etcshadow
in thread use File::Slurp for (!"speed"); by etcshadow

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, 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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (7)
    As of 2019-10-22 13:27 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?