I too have read about File::Slurp and how it's supposed to be super fast. However, check this out:
using read function 0.684900999069214 0.681570053100586 0.680304050445557 0.675194025039673 0.684563159942627 0.686581134796143 File::Slurp 1.57559299468994 1.5706889629364 1.5739688873291 1.5618691444397 1.56290698051453 1.58691692352295
That's using the same test as above, replacing
open(FILE,"<$file") || die $!; my $data = do { local $/; <FILE> }; close(FILE);
with
my $data = read_file($file);

In reply to Re^2: Speed reading (files) by kwaping
in thread Speed reading (files) by kwaping

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.