Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Win a copy of The macOS App Icon Book with thisfree giveaway

Xcode Build Insights: Keep track of project compilation times

Xcode Build Insights lets you keep track of compilation times to ensure your project doesn’t suddenly become slow to build. You’re likely building your project tens of times per day, so compilation times that become slower can significantly impact your overall productivity.

While Xcode keeps a history of your builds, it only briefly retains it. Unfortunately, only about thirty of your recent builds will be retained, and all logs get deleted when upgrading to a new Xcode version or when you delete your derived data folder. Luckily, a solution allows you to track compilation times over months to come.

The importance of tracking compilation time

If you’ve worked on a large project built over several years, you’ll know the importance of tracking compilation times. There’s no reason to optimize when starting a new project, as build times will be fast. However, slowly but surely, your project grows, adds more libraries and compilation time increases.

Imagine a project compilation time of 20 seconds for a team of 10 engineers. When every developer builds about 100 times daily, you’ll spend 20 * 10 * 100 = 20.000 seconds per day waiting for builds to complete. That’s almost 6 hours!

Now, imagine that the build times suddenly increase to 30 seconds. That’s a 50% increase, resulting in 3 extra hours daily waiting for a build to complete. I’m pretty sure your team can make that time more valuable!

How to monitor Xcode Build Times

Xcode stores build information inside your derived data folder. Unfortunately, these logs are cached briefly and will be removed after a certain threshold, an Xcode update, or when you delete your derived data.

In the latest version of RocketSim, all your builds will be cached. You’ll be able to track builds for months to come, providing valuable insights. You can access build insights from the side window:

Using RocketSim's build insights, you'll be able to keep track of compilation times.
Using RocketSim’s build insights, you’ll be able to keep track of compilation times.

The side window shows the 7-day p95 duration which will be your first impression of current compilation times. When there’s a sudden drop, you’ll see that by the red arrow and percentage of change:

RocketSim shows how your compilation times changed over the past seven days.
RocketSim shows how your compilation times changed over the past seven days.

In this case, our compilation time increased by 1%, which might be acceptable in an early-stage project. However, if this is unexpected, you can use this as a starting point to look deeper into the details.

Excited to get started?

Download RocketSim from the Mac App Store

The impact of different Xcode versions

I’m not sure about you, but whenever a new major version of Xcode arrives, I’m mostly interested to see how build times improved. RocketSim’s Xcode benchmarks chart allows you to benchmark your personal projects per Xcode version:

Xcode benchmarks allow you to compare build durations across Xcode versions.
Xcode benchmarks allow you to compare build durations across Xcode versions.

In this case, I built one of my projects using Xcode’s 15.4 beta and concluded there’s little difference between the builds. However, since I just did one build, this data might be insignificant and, therefore, it’s essential to look at p75 and p95 values.

Understanding p75 and p95 percentile values

Just like it’s important to be aware of statistical significance when running experiments, it’s also important to not conclude anything from a few builds. Using so-called percentile values, you’ll be able to focus on representative outcomes of multiple Xcode Build times.

A p75 value means 75% of the build times fall below this value. Similarly, p95 means 95%, excluding the top 5% outliers. With a large set of data, percentiles offer a more robust measure of central tendency compared to averages because they are less affected by extreme values or outliers in a dataset.

Stay updated with the latest in Swift & SwiftUI

The 2nd largest newsletter in the Apple development community with 18,996 developers. Don't miss out – Join today:

You can always unsubscribe, no hard feelings.

Xcode Build Insights for Teams

While individual Xcode Build Insights are great, they’ll become even more valuable when you can compare them with your colleagues. You might have been having much slower build times compared to your colleagues without knowing!

Bring build insights together for a team allows you to answer questions like:

  • What is the total build time spent by our whole team?
  • Which machine setup results in the best build performance?
  • How does our compilation time compare across all team members?

Using those insights, you might realize it’s best to give every developer an M3 Max to decrease the overall time spent on compiling. For example, imagine the price of €4.299 for a MacBook Pro 16″ 2023 with a M3 Max 16-core CPU. If a developer earns €100 per hour, you’ll earn back the MacBook if build times decrease by 43 hours. The popular Xcode Benchmark repository shows a 100 seconds faster build time than a MacBook Pro 14″ 2021 M1 Pro 8-core. This doesn’t represent incremental build times, but it could still easily lead to spending 1000 seconds less per day waiting for compilation to complete. That means you’ll earn back the machine upgrade in less than 6 months.

Obviously, this is all hypothetical, but I’m sure you want to know which machine setup performs best for your team, as you’re spending a lot of money on every developer’s setup. Therefore, you can now sign up for early beta access to RocketSim Xcode Build Insights for teams:

Sign up for Xcode Team Build Insights (Beta)

Conclusion

Xcode Build Insights allows you to keep track of compilation times and ensures your team remains productive. A sudden increase in compilation times can drastically impact productivity, as your whole team will spend more time waiting for builds to complete.

If you like to improve your Xcode knowledge, even more, check out the Xcode category page. Feel free to contact me or tweet me on Twitter if you have any additional tips or feedback.

Thanks!