Sunday, August 28, 2011

Running Windows 7 in a Virtual Machine Under OSX To Double Battery Life

I have had a Macbook Pro for a few years now and absolutely love the hardware (currently have an i7 model) but personally even after all this time find the usability of OSX far inferior.  I don’t want this post to turn into a debate about which is better, but if you prefer Windows 7 to OSX then you may find some value in this post.

Up until recently I have been running Windows 7 natively (ie – using Bootcamp drivers) on the Mac and it runs flawlessly, except for one issue which has always griped me – battery life.  The problem is that Apple do not provide a driver for their graphics switching magic voodoo hardware solution, so under Windows 7, the dedicated NVidia or ATI graphics chip is constantly used.  This is fine if you use the Mac to play games all day long, but if like me you are just doing development or word processing, etc it is a pain that your 7-8+ hours of battery life under OSX is reduced to 3-3.5 hours under Windows 7.  Not to mention the MBP gets much hotter due to the graphics chip working overtime.  So after realising there is no native solution (and probably will not be in the foreseeable future, if ever) I came to the conclusion that the only hope was to run Windows 7 in a VM under OSX and then force the graphics in the MBP to always use the integrated graphics using the excellent gfxCardStatus utility.  This utility allows you to force OSX to use either the integrated graphics, dedicated graphics or auto switching feature of the operating system which is cool.  Personally I set it to always use integrated graphics which I have found fine for every application I have tried, even GPU intensive ones, but the choice is always there to use switching if required which is nice.

As a VM solution I am currently trialing Parallels, which most objective reviews that I have read (ie – ignoring forums full of people stating their ‘preferences’) is superior in performance.  The result I have observed are as follows:

Windows 7 native (Bootcamp) 3 – 3.5 hours
Windows 7 running under Parallels 5.5 – 7 hours

The variation I have experienced is due to what applications you use during a given session.  Unfortunately I do not have much time so I cannot present more comprehensive results, but the above was gathered over 10 days.  So clearly, when it is able to use the integrated graphics, Windows is able to achieve very close to what I get under OSX.  If only Apple would release a native driver … Still I don’t hold my breath so I highly advise this solution to all Windows 7 users.  You also get a few other improvements as an added bonus.  First of all, the ACPI capabilities now function correctly (again lack of drivers from Apple is a cause of this) so that the screen reacts promptly and quickly to ambient light changes.  You also get the ability to switch to OSX which is handy if you are doing iOS dev, etc and the ability to seamlessly integrated with OSX applications is nice (ie open files with OSX applications).

There are some downsides of course.  Performance is not as good as running natively – whilst many people in the Apple forums seem ‘happy’ with the performance (always a great word to use when measuring performance) it is clearly slower than running Windows natively.  The problems largely come when you switch between Windows and OSX.  If you stay in either it is fine, but it is not uncommon for me to wait minutes after switching from Windows to OSX before OSX even becomes responsive.  Applications take noticeably longer to load in a VM and so on.  WPF applications do not perform correctly under Parallels unless you turn off graphics acceleration.  However most of these issue come to IO limitations.  You can clearly hear the hard drive being thrashed to bits and would be largely solved with the use of an SSD.

I am out of time so in conclusion, all I can say is give it a go for yourself, but given the doubled battery life I achieve when running in a VM, I am happy to put up with the relatively small losses I observe.  As for the actual VM software, I think largely all three options (Fusion, Parallels and VirtualBox) are going to be comparable in performance.

No comments: