What gave you that impression?
my $f; open($f,'<',"bigfile") or die "Could not open file\n"; my $i; while ($i++<1000000) { seek($f,10,0); seek($f,3000,0); }
This script needs 1.2 seconds on my machine, for 2 millions seeks. Time for the loop without anything in it is 0.275 seconds, so we are at 460 nanoseconds per seek
my $f; open($f,'<',"bigfile") or die "Could not open file\n"; my $i; my $g; while ($i++<1000000) { seek($f,10,0); $g= <$f>; seek($f,3000,0); } print length $g,"\n";
This script additionally does one million reads of a 2 character string and runs 3 seconds. That means 1800 nanoseconds is the minimal time for a read (from cache obviously, if the data is on disk multiply that time by 1000 or more)
In reply to Re^3: Initialsing file pointer in the middle of a file.
by jethro
in thread Initialsing file pointer in the middle of a file.
by sabertooth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |