---
title: "#235: Debugging Slow Builds with BuildTimeAnalyzer 🛠⏲"
url: https://littlebitesofcocoa.com/235-debugging-slow-builds-with-buildtimeanalyzer
author: Jake Marsh
date: 2016-05-09
published: 2016-05-09
topics: ["Plugins","Tools"]
description: "Plugins are a great way for us to extend Xcode, adding functionality that Apple didn't ship with it. We've covered Xcode plugins a bit here in the past..."
---

# #235: Debugging Slow Builds with BuildTimeAnalyzer 🛠⏲

By Jake Marsh, May 9, 2016. HTML: https://littlebitesofcocoa.com/235-debugging-slow-builds-with-buildtimeanalyzer

**Plugins** are a great way for us to extend **Xcode**, adding functionality that **Apple** didn't ship with it. We've covered **Xcode plugins** a bit here in the past, notably in [Bite #147](https://littlebitesofcocoa.com/147), where we learned about using [Alcatraz](http://alcatraz.io) to install **plugins**. Today we'll look at a new plugin called [BuildTimeAnalyzer](https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode) from [Robert Gummesson](https://github.com/RobertGummesson). It can help uncover why are code is compiling slowly. Let's dive in.

We'll start by completing the steps in [Bite #147](https://littlebitesofcocoa.com/147) to install [Alcatraz](http://alcatraz.io). (If we're going to be installing and trying out plugins [Alcatraz](http://alcatraz.io) is a good way to organize and manage everything). 

Once installed, we'll open the **Alcatraz Package Manager** by going to **Window** > **Package Manager**.

We can search for <i>"BuildTimeAnalyzer"</i> in the search field to find the plugin and install it. Once installed, we'll restart **Xcode** and open our **project**.

We can open the analyzer window by selecting **View** > **Build Time Analyzer** from **Xcode's menu**.

Next, we'll need to add some **compiler flags**.

(Remember to add these to any other targets your app may depend to see compile times for those too).

We'll add `-Xfrontend` and `-debug-time-function-bodies` to the **"Other Swift Flags"** in our **app's** target's build settings.

After that, one last clean and build and we should start to see a list of how long each bit of our code is taking to compile. Neat!

<img src='https://media.littlebitesofcocoa.com/bite-assets/235-1.png' style='max-width: 452.5px;' />

We can click on each result to jump straight to the line of code that's causing the slow down. The results are often surprising!

For example: Adding **Collection types** together seems to bring the **Swift compiler** to a slow crawl.

What interesting slow downs did you find in your code? Send them to [@lilbitesofcocoa on Twitter!](http://twitter.com/lilbitesofcocoa)

More info about _BuildTimeAnalyzer_ can be found at [git.io/bta](https://git.io/bta)
