I use the wonderful Parallels 6 to perform all my Windows development. (I find working on a Mac makes Windows development a lot more bearable - at least for this old Unix-head).
In general, Parallels works superbly (and is reported to perform a lot better than VMware, if you believe the hype). However, for operations like rebuilding a large, complex C++ source tree, the virtual machine performance lagged a long way behind a native machine. Large compiles can take more than twice the time of a real Windows PC. Clearly, this taxes the host machine hard: hammering CPU, memory, and disk at once.
This problem exhibits on my four core Mac Pro with as many resources as I could throw at the problem, as well as on my more humble MacBook Pro.
I performed a number of experiments to work out how to fix this:
- Tweaking the allocated CPU cores, memory, and disk space
- Tweaking the settings for the virtual hard drive
- Network building from host mac file system
None of these made much difference. In fact, I was somewhat surprised that operating on a networked disk was fantastically slower. That was a shame, as it would be advantageous to share a single source tree with my Xcode development for cross-platform development. (As it happens, I manage this by having a Windows-side git clone of the git repo on the Mac side).
However, I've now managed to get my compile times right down. Here's how.
Do bare in mind that these tweaks are in addition to the obvious steps you should take with any machine:
- Have as fast a CPU as possible.
- Throw as many CPU cores as you can at the problem - builds can be parallelised very easily.
- Throw as much memory as you have at your disposal at the problem.
1. Swap the swap
The factor slowing me down the most turned out to be the Parallels virtual disk that Windows was running on. First, the swap file was hosted on it. So I made a second virtual disk, and pushed the virtual memory off onto it. That made a small, but appreciable difference.
2. Only ever use fixed size disks
In your disk settings, do not use automatically expanding disks. That's just another overhead for the computer to manage whilst accessing disks. Create a fixed size blob of disk space and run with it.
3. Use a virtual SCSI disk
This is the big one. So pay attention at the back.
It seems that Parallels can emulate a SCSI disk far, far faster than it can emulate and IDE disk. However, it defaults to creating IDE disks. I believe that this is to make installation of Windows simpler, as you don't have to fettle with custom SCSI drivers during installation.
You can't just switch the main disk from IDE to SCSI, though. Windows has a minor eppe and refuses to run if you do that. I couldn't be bothered to wipe it all and try to reinstall on a new SCSI virtual disk, so I added yet another large SCSI virtual disk for my source trees and checked out onto that disk.
Remember: it's a fixed size, non-expanding SCSI disk.
With this configuration the build simply screams in comparison to building on the virtual IDE C: drive.
I hope you find this information useful!