I’ve got a 320GB 7200RPM drive in an external USB housing that I use for extra storage and backup with my 15″ Macbook Pro. I also use Parallels a fair bit because I do ASP and ASP.NET web development, so I was wondering if it’d be faster to run the Parallels VM off the external hard disk, so that the internal one could be reserved for OS X duties including virtual memory paging.
I read a blog post that advises not to use an external USB hard disk to host your Parallels VM, but it’s mainly theory based on bus speeds and whatnot. In theory, there is no difference between theory and practice. But, in practice, there is.
So I thought I’d write a C program to write a fairly large file to both the local hard disk and the USB disk, and time them to see which one is faster. Here are the results:
USB drive (Seagate 3.5″ 320GB 7200rpm with 8MB cache):
/Volumes/EVERYTHING_/writeperf.txt
real 0m10.278s
user 0m0.396s
sys 0m0.386s
Internal drive (Fujitsu 2.5″ 120GB 5400rpm with 8MB cache):
/Users/glennkentwell/Documents/Code/C/writeperf.txt
real 0m2.480s
user 0m0.233s
sys 0m0.414s
As you can see, a huge difference in the real time taken to write the file. There’s not much difference in the amount of CPU time (0.18 seconds) which is not surprising, as most of the time would be spent waiting for the data to transmit across the USB cable, and the SATA bus is very fast. I should really have run this multiple times and taken the average, but I can’t be bothered so instead I’ve just run it a bunch of times and taken a result that looks typical to me
This is hardly an exhaustive test — I didn’t even try reading from the disk or doing random access, because I just wanted a rough idea how big the differences are. Nevertheless, here is my code and the bash script I wrote to run this
C code: (at pastie.org)
To compile:
gcc writeperf.c -o writeperf
To run (you’ll need to change the paths to suit your filesystem, obviously):
while true; do time ./writeperf /Volumes/EVERYTHING_/writeperf.txt; time ./writeperf ~/Documents/Code/C/writeperf.txt ; done
I take no responsibility for anything you damage with this code