glwtta has asked for the wisdom of the Perl Monks concerning the following question:
I have a file which is roughly half a GB (11 million lines), simply doing:
takes about 7.5 seconds.my $line; while ($line = <>){ print "$.\n" unless ($. % 10000); # to keep track of the progress }
takes about 23 seconds (same for IO::File); whereas this:my $in = FileHandle->new($ARGV[0]); my $line; while ($line = $in->getline){ print "$.\n" unless ($. % 10000); }
takes over 10 minutes!use IO::All; my $in = io($ARGV[0]); my $line; while ($line = $in->getline){ print "$.\n" unless ($. % 10000); }
Are others seeing this sort of performance? Is this to be expected?
If it makes any difference, I am running perl 5.8.4 on RedHat Linux 7.3 (reiserfs)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IO::All speed issue
by eserte (Deacon) on May 11, 2004 at 15:27 UTC | |
Re: IO::All speed issue
by duff (Parson) on May 11, 2004 at 15:34 UTC |