doing it wrong

Blogging with Class

Potential Gotcha in Xcode

After upgrading to the iMac the other day, I quickly wanted to see if there was an improvement in build times with Xcode.  Well, it was more of that I wanted to see how much of an improvement there was – of course there was going to be an improvement.  I was going from a 2GHz C2D laptop to a 2.66GHz Core i5 Quad desktop.  That should be a massive improvement.

So to find out, I did a complete build of Ballies for the iPhone from the command line using the time command to tell me how long it took.

C2D MacBook -- 2m42.01s
   i5 iMac -- 2m16.212s

Erm, what happened here? Sure it was an improvement, but less than 30 seconds off the build time seems a bit underwhelming. Compared with everything else I’ve seen on this machine so far, there had to be something off.

So I started taking a look around. I happened to notice a difference between the two builds – on the MacBook, I saw that xcodebuild was using the CompileCC task. But on the iMac, it was using distcc. Hmmm… I didn’t configure distcc, did I?

Well, it turned out that I had configured distcc – on a previous machine. In fact, it was two machines ago. I had migrated my home directory from a PowerMac G5 earlier this year to a Mac mini. While it was on the Mac mini, I hadn’t been using it for development since I had the faster MacBook to work on. And when I bought the iMac, I migrated my home directory again to the new machine – with distcc still turned on.

Making it worse is that I no longer had any machines configured to be a distcc server. So the additional overhead of using distcc without having any build servers led to horrible build times.

So with distcc turned off, I ran a new build and got this:

0m49.203s

Much better – in fact, I played around with disabling cores, and it wasn’t until I got down to just one core that the MacBook could beat the iMac. Of course it had to use two cores to do it.

So if you are running into slow builds in Xcode on a machine, check out the distributed builds setting in Xcode. You can learn more about distributed builds here.

Dec 05, 2009

Copyright © 2006-2026 Dennis Munsie.