If you have a machine with a lot of ram (e.g. an hp workstation with >40gb), then it makes sense to have a script pre-cache files you will use often. The easy way is to copy everything to a ramdisk, and then delete it. The Os will read the data in, cache it in memory, and not release the cache until it needs to. The following simple Perl script, written for cygwin, illustrates:

For a Linux version, if your /tmp is a tmpfs ramdisk, just adjust the to something there.


# simple poor man's pre-caching

open F, "inlist" || die("cannot open inlist");
@inlist = <F>;
close F;

$t = 0
@fs = ();
for (@inlist) {
	chomp; # warning: this script will not work if any filename has spaces at the end! Don't do that!
	$a = -s;
	print "$a $_\n";
	push @fs, $a;
	$t += $a;
$n = int(@fs);
# do the copying
$tmpfile = "/cygdrive/a/deadfile";
$d = 0;
for(@fs) {
	# now we just copy each file to $tmpfile, overwriting the previous
	# this will force the contents into the OS's disk cache
	$a = -s;
	print "Copying $_ ";	
	copy $_, $tmpfile;
	$d += $a;
	print "done ($d/$a bytes) ($i/$n files) ".(sprintf "%.2d%%" ($d/$a))."\n";
unlink $tmpfile; # delete the temporary file -- it will still be cached until something else needs the memory
print "Done.\n";