The fastest way to pull the file in
To get a baseline on how quickly you can get the entire file into memory, something like
\nmy $contents;\nsysopen(F, "somefile.dat");\nsysread(F, $contents, -s F);\nclose(F);\n
is about as fast as you can go in Perl. But that might not help if you need to slice the file into pieces for processing, since the pieces will need yet more memory.