BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News XCRemoteCache Aims to Speed up iOS App Build Times

XCRemoteCache Aims to Speed up iOS App Build Times

This item in japanese

Bookmarks

Spotify created XCRemoteCache to reduce Xcode compile times. Recently open-sourced, XCRemoteCache can decrease clean build times by 70%, says Spotify.

As the name suggests, this library is a remote caching implementation for iOS projects with an aim to reuse Xcode target artifacts generated on Continuous Integration (CI) machines.

The idea behind a remote build cache is downloading pre-compiled artifacts that are shared on some other machine instead of building them locally. In Spotify case, building the main Spotify app could take up to 10 minutes, especially after rebasing or merging remote branches. This represented the ideal case for a remote cache, says Spotify.

XCRemoteCache uses fingerprinting to identify build products that can be reused. Given Xcode's way of identifying all input files for a compilation unit without requiring to explicitly list all dependencies, XCRemoteCache has to rely on metadata generated at build time to identify the files that went into a given build. Those metadata are associated with the corresponding commit identifier to create the fingerpring, which is later used to identify the prebuilt artifacts that can be leveraged for another build.

To measure the performance improvement brought by XCRemoteCache, Spotify carried through a controlled experiment by having 50% of the developers use it during a week and compared the outcomes with the rest of their developers.

Results exceeded our expectations — we observed a huge improvement of the local build times: median clean build and incremental build times decreased by 70% and 6%, respectively. We classify builds as clean when at least 50% of all targets compile at least one file. Other builds that compile at least one file are incremental.

Spotify has been using XCRemoteCache for over one year now and reported positive feedback from its developers.

One key aspect for successfully integrating XCRemoteCache in a project is splitting it into several targets, which are used as caching units. Caching units should not be too big nor too fragmented to ensure local build minimization and to avoid frequent cache invalidation.

XCRemoteCache can be easily integrated into an Xcode project using a CocoaPods plugin and requires an HTTP server that supports PUT, HEAD, and GET requests, including Amazon S3 and Google’s Google Cloud Storage. XCRemoteCache is compatible with projects that use CocoaPods, Carthage, or other dependency managers.

Rate this Article

Adoption
Style

BT