So I decided to re run your benchmark after making both pieces of code as close to possible as identical. Below are the results and the code, it would appear that it makes no differnce which to choose, both were faster once, and they actualy tied once. I took them tieing on the third run to be a sign ;)

C:\Perl\Tests>dir data.txt Volume in drive C has no label. Volume Serial Number is 445B-6F9C Directory of C:\Perl\Tests 08/15/2005 08:32 AM 11,262,298 data.txt 1 File(s) 11,262,298 bytes 0 Dir(s) 224,083,968 bytes free C:\Perl\Tests>perl PerlIOvia.pl Rate perlio regular perlio 7.57/s -- -0% regular 7.61/s 0% -- C:\Perl\Tests>perl PerlIOvia.pl Rate regular perlio regular 7.55/s -- -2% perlio 7.68/s 2% -- C:\Perl\Tests>perl PerlIOvia.pl Rate perlio regular perlio 7.66/s -- -0% regular 7.66/s 0% -- C:\Perl\Tests>
And the code itself:
use PerlIO::via::MD5; use Digest::MD5 qw(md5_hex); use Benchmark qw(:all); my $file = "data.txt"; cmpthese(-5, { perlio => \&perlio, regular => \&regular, }); sub perlio { local($/) = undef; open(FILE,"<:via(MD5)", $file); my $digest = <FILE>; close FILE; } sub regular { local($/) = undef; open FILE, "<$file"; my $data = <FILE>; close FILE; md5_hex($data); }


___________
Eric Hodges

In reply to Re^4: PerlIO slower than traditional IO? by eric256
in thread PerlIO slower than traditional IO? by saintmike

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.