Is Compilation CPU Bound?

While compiling my Mac Value Analysis, I started wondering how important the CPU performance of a machine is for a developer.

With all the talk recently about SSDs as the savior of computing performance, I had assumed that things like compilation had become I/O bound and therefore most sensitive to changes in hard drive. If that were the case then things like Geekbench64 become even more obtuse measures of real life capability. While synthetic benchmarks always exhibit this drawback, I didn’t want to be overly misleading my comparisons.

As a developer I probably spend 80% of my day in Xcode. Within that 80% probably the majority of my non productive time each day is spent during compilation. Each time I hit “Build and Go” and then wait for the app to launch is time wasted.

Method

To try and quantify the impact of CPU vs Hard Drive, I came up with the following test using what I had around in my office.

  • I had three Firewire 800 hard drives available:
  • An Other World Computing, Mercury Extreme Pro SSD
  • A Hitatchi 5400RPM conventional disk
  • A lacie BigDisk set to RAID 0
  • I have two machines
  • A late 2009 27” iMac: 2.8GHz Intel Core i7 (Quad) [Geekbench64 9890]
  • A mid 2009 15” MacBook Pro: 2.53GHz Intel Core 2 Duo (Dual) [Geekbench64 3581]
  • I have three main projects Audiobooks, SimpleCasts and My Recipe Book
  • These projects represent a good variety of code and resources and together provide a pretty good baseline of a ‘typical’ iOS app project.
  • I copied each project onto each of the drives
  • Then, I ran xcodebuild clean && time xcodebuild with each of the machines connected to each of the drives.
  • This gave me a rough estimate of the compilation speed of each setup.

Results

results

From this it appears that CPU is far more significant factor in compilation time than hard drive choice. The predictable increase in speed was seen moving from a slower to faster hard drive, however, these improvements (in the range of 10-15%) are dwarfed by the CPU changes.

What seems most interesting in all this is that moving from the one machine to the other the overall average for each machine increased almost exactly as quickly as the Geekbench64 result. The increase from 3581 to 9890 in score was matched by a change in 12.55 to 34.79, a change of 2.76x and 2.77X respectively. This is likely more of a coincidence than a rule, however, it is still an interesting result.

That isn’t to say that an SSD isn’t helpful. When I upgraded my iMac to an SSD I saw a nice bump in my daily usage, and I would continue to recommend SSDs as the best option for your main boot device.

Notes

  • The gains you see based on a changes in CPU aren’t really representative of actual time savings for each compilation since Xcode does incremental build.
  • Choosing your machine based on just statistics like this would be rather foolish. Ultimately the best machine is the one that best fits your work style and budget.
David Smith