Speed up xcode builds

I’m trying to work out how to speed up my xcode builds as they currently take ~18 minutes. I’ve googled and found this https://blog.bitrise.io/60-percent-faster-builds-force-xcode-use-caching . But am I right in thinking that that only works for test builds, not for a full app store archive?

It’d be really useful to hear the latest best practices.

We are using continuous delivery on our stable and productive branches (alpha & beta), but if you create a different workflow for your merge requests (work/ branches), you can save time for the main development lane through caches.

I think without knowing how you are working, it’s hard to help. We use the git-flow branching model and only our merge-commits take longer than 10 minutes. Most CI-runs are below 10 minutes.

Also note that there’s a feature to cancel builds for outdated commits on the same branch. This can also save time (or at least money). See this blog post.

Hi @benrobinson using cache and recursive touch combination speeds up your xcode tests, however it does not speeds up the xcode’s archive process.

The caching by itself may speeds up your builds (build for test or build for archive) as described at the header section in the caching article: https://devcenter.bitrise.io/caching/about-caching/

2 Likes

Worth to note this has nothing to do with bitrise, this is how Xcode works. Try it on your own Mac. If you generate a .ipa via Xcode -> Archive then the whole project will be recompiled.

Additionally, depending on the configs, e.g. appstore distribution, the .ipa export will also take significant time.

To be able to tell you whether the built time can be improved, please share how long it takes on your own Mac to:

  1. Archive the project
  2. Then Export a signed IPA, with the same signing type (e.g. App Store) as the one you do on bitrise.io

Thanks, that’s very helpful – will give it a go. I presume it’s not that instructive to compare build times on my own mac with build times on bitrise’s VMs since I imagine there’s differences in CPU/network speed?

Well, it would provide a good comparison point. E.g. if it takes ~18 mins on your own Mac then it’s quite unlikely that it would be significantly faster on our build machines. Mainly because an Archive is always a clean build, and the Export (which creates the signed IPA) is mainly about signing & packaging, which isn’t really multi thread friendly, additional CPU resources won’t speed it up significantly.