Just as a simple I/O test, I played around with just creating a 500MB file and then copying that file to another file on my old WinXP machine.
#!/usr/bin/perl -w
use strict;
my $begin = time();
open (BIG, ">fiveHundredMB") or die "cannot open file for 500MB write"
+;
my $c255 = '*'x255;
my $c256 = "$c255\n";
my $oneK = "$c256"x4;
my $oneMB = "$oneK"x1024;
print BIG $oneMB for (1..500);
close BIG;
my $end = time();
print "elasped time for 500MB file is: ", $end-$begin, " seconds\n";
__END__
elasped time for 500MB file is: 9 seconds
I opened this file in my text editor and there are
2,048,000 lines of 256 chars = 524,288,000 bytes.
Windows says: 526,336,000 bytes at command line.
This difference is a mystery to me at the moment.
But this is basically a ~500 MB file.
#!/usr/bin/perl -w
use strict;
my $begin = time();
open (BIG, "<fiveHundredMB") or die "cannot open file for 500MB read";
open (OUT, ">bigfile") or die "cannot open bigfile for write";
while (<BIG>)
{
print OUT $_;
}
close OUT;
my $end = time();
print "elasped time for 500MB file is: ", $end-$begin, " seconds\n";
__END__
prints:
elasped time for 500MB file is: 13 seconds
Even at 22 seconds, the execution time seems slow, but that depends upon the number of regex'es you are running per line of input and how many lines that there are. I suspect that they are far less than 1024 bytes in length on average. If your performance is adequate for your use, I would stick a fork in it and call it done! I wouldn't worry about it. About 13-14 seconds is as fast as a single HD can go without any processing of the data. |