Visual Studio.NET development on OS X w/ Parallels

EDITED x3: I’ve completely moved over to VMWare Fusion and have dropped Parallels like a rock. Check out my posts here and here.

EDITED x2: I have removed a comment pretending to be me.

EDITED: MSDN behind the scenes post about the death of VirtualPC

At the beginning of June, I decided to treat myself to a new 15-inch MacBook Pro. I have been yerning for a new Mac ever since selling my old 12-inch G4 Powerbook. I now work from home and I didn’t have a company provided laptop anymore, so instead of upgrading an old desktop, I decided to splurge. The one hitch in my plan was the fact that I still did a fair amount of .NET development. Sure, there is Mono for OSX, but that’s a far cry from Visual Studio.NET on Windows XP. Clearly, I would need a solution that allows me to run Windows XP on my MacBook Pro.

Previously, I had been able to do some .NET development on OSX using Microsoft Virtual PC. In light of Apple’s transition to the Intel platform, Microsoft has decided to discontinue VirtualPC for the Mac. This is a direct result of the fact that VIrtualPC is a emulation based virtual machine solution, and thus, is based on the translation engine. Microsoft felt it would be too difficult to move VirtualPC over to the Intel platform because of how closely it was tied to the x86-PowerPC translation engine that previous versions ran on. Also, I am sure that it is not a coincidence that this announcement from Microsoft came a day after VMWare announced a beta of their product that ran on the new Intel Macs.

However, before there was a VMWare beta, a company named Parallels came out with their product, Parallels Desktop, also for the new Intel Macs. Both Parallels and the new VMWare beta offer greater speeds than Virtual PC because both are virtualization solutions, as opposed to Virtual PC’s emulation based approach. Since Parallels was out first, that’s what I am currently using.

Before we delve into Parallels, I wanted to mention an alternative to running another operating system on your MacBook: Apple’s BootCamp. However, I have chosen to dismiss this as a viable option because it requires you to actually boot into the other operating system, and run it natively. Since the main reason that I bought a MacBook Pro was to run OSX again, this isn’t really an attractive solution.

My MacBook is the lower end 15-inch, though there are no significant differences between both 15-inch MacBooks, other than increased storage, a minor speed bump and double the graphics memory. Since I am not into playing games, the graphics memory really didn’t matter to me. I also upgraded to 2 GB of RAM, since I knew i would be using Parallels a lot, and if there’s one truth about ALL virtual machines, it’s that they LOVE memory.

After 2+ months of working with Parallels every day, I can honestly say that it’s a pleasant working environment. Everything that I can do in OSX, I do. Everything else, I run in a Windows XP instance within Parallels. This includes:

* Visual Studio .NET 2005 & 2003
* SQL Server Enterprise
* ASP.NET & IIS
* Adept SQL Diff
* RedGate ANTS Profiler
* FireFox
* Other misc .NET utilities

That’s not a minor list of apps. SQL Server runs two databases, one of which is several hundred MB’s in size. With the exception of some stability problems that Visual Studio.NET 2005 has with regards to Visual Basic projects, I haven’t experienced any crashes or lock ups, nor have I been upset with the speeds of Parallels.

However, that’s not to say that there can’t be improvements. Already, some people have released hacks and “tweaks” to Parallels. One app in particular, PDTweaker, make two minor changes to the Parallels concerning the caching of the virtual machine and how often data is flushed to your OSX file system. At the time of this writing, Parallels has released a new beta that comes with several speed enhancements & stability improvements as well as increased device support. I am using the beta right now, and I have seen as increase in speed, but I comment on the increased device support. The beta also includes the caching change included in PDTweaker, however it is unknown if it also includes the other PDTweaker change.

One area that I would like to see the folks at Parallels update is the graphics speed, detailed on the PDTweaker page. Apparently, the current implementation of the graphics driver flushes WAY more often that it needs to.

Quote:

“With Quartz Debug still active, now open Notepad (or, if you have it, Microsoft Visual Studio). Start typing. You’ll see the entire window flash for every single character! Let’s do the math here to show how bad this is. Rather than flushing roughly 16×16 = 256 pixels to draw a character, on my MacBook it’s actually flushing as many as 1280×800 = 1,024,000 pixels instead! That’s a whopping 4000 times as much data being moved around than is actually necessary.”


You can see how something like could be a problem for someone who types in a code editor most of the day.

Before wrapping this up, I wanted to spend some time on one of the trickiest areas of Parallels use: memory allocation. More specifically, how much memory to allocate to Parallels Desktop itself, as well as each individual virtual machine. Memory allocation is somewhat of a catch-22. On the one hand, you want your virtual machine to run as fast as possible. On the other, you don’t want to affect the performance of native OS, which, BTW, is running Parallels Desktop.

So what’s the answer? Unfortunately, it depends on what you do. Anywhere between 256-512MB should be enough for basic tasks. However, since this post is about Visual Studio.NET development, I’ll talk about my setup and my experiences in that light. At first it seems logical to spilt my computers’ memory right down the middle: 1GB for Parallels and 1GB for OSX. I have found this to be inefficient. Everything non-Visual Studio.NET related I run in OSX and some of those applications can be memory hogs too. For example, during my typical work day I have the following OSX applications open:

* Entourage ( Mac Outlook )
* Camino Browser
* Colloquy ( IRC client )
* Adium ( Multi-client IM client )
* NetNewsWire ( RSS Aggregator w/ 250+ feeds )
* iTunes ( duh… )
* One or more Microsoft Office applications ( Word, Powerpoint or Excel )
* Several dashboard widgets

Now, one can see how running all those apps, plus dedicating 1GB of memory to Parallels Desktop, can leave my computer sluggish, and can slow everything down to a crawl.

Next I tried 512MB for Parallels. That gave me satisfying performance for OSX, yet left Parallels very sluggish and frustrating. I found the sweet spot to be 800MB for Parallels Desktop, after initially upping it to 768MB. Dedicating 800MB to Parallels left me with enough memory in OSX for my day to day use, but also gave me a pretty snappy .NET development environment in Parallels.

I toyed around with the idea of removing my paging file from my Windows XP instance. The logic being that i’d rather have Parallels swapping to my OSX virtual memory file rather than have the virtual machine swapping to its own paging file. However, my results weren’t stellar. Windows XP quickly runs out of memory as soon as I load up Visual Studio.Net. I am sure some of that has to do with the VB.NET issues listed above ( the VS.NET instance occupies 350MB+ of memory ). So for the time being, I am still using a swap file in Windows XP.

All in all, I think that Parallels is a very viable option for doing .NET development on OSX and I am very happy with my new development environment.