I run a perl script inside a Virtualbox (both the host and guest OS are Windows 7). The Virtualbox has been given 4 CPUs out of 8 (everything runs on a Intel i7) and 3 GB RAM (out of 8 available).
The 2-threaded perl program, which has plenty of RAM available, does a lot of I/O, reading and writing files and issueing perl "system" commands (i.e. executes external programs).
To achieve better performance, I tried using a RAM disk (512 MB, enough to contain both input and output files).
I copied there all input files and the script (slightly modified in order to consider the new disk). The output files are created correctly on the RAM disk, but surprisingly, it takes much more time than using the ordinary hard disk.
Here are the "benchmarks":
with RAM disk: about 1 H 03 min 45 sec.
without RAM disk: about 32 min 15 sec.
(please remember, everything runs inside a Virtualbox and the RAM disk is configured inside the guest OS).
Only the perl.exe and libraries still remain on the 'ordinary' C: disk.
What happens? Why the RAM disk hasn't improved the benchmark?