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 ;)
And the code itself: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>
use PerlIO::via::MD5; use Digest::MD5 qw(md5_hex); use Benchmark qw(:all); my $file = "data.txt"; cmpthese(-5, { perlio => \&perlio, regular => \®ular, }); 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); }
In reply to Re^4: PerlIO slower than traditional IO?
by eric256
in thread PerlIO slower than traditional IO?
by saintmike
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |