Build Performance Best Practices
Optimizing build performance can be approached by identifying and resolving bottlenecks one at a time. This article contains some ways to identify and resolve specific bottlenecks. This article also contains best practices to help you improve performance.
Optimizing Xcode Parallelism
Xcode builds try to run multiple compilations concurrently, typically limited by the number of cores on the Initiator running the build. When using Incredibuild for Mac, the number of cores available can grow significantly, and in some projects the parallelism that Xcode creates by default is not high enough. Add the option -parallelizeTargets to your xcodebuild command to increase the parallelism further. You can test your build with and without this option to investigate it’s effect.
Optimizing Network Utilization
Incredibuild for Mac transfers data between the Initiator and the Helpers. In some cases the network may become a bottleneck for the build's acceleration. Therefore, we recommend using a 10GbE network. If your network is 1GbE, or if you build over VPN, we recommend enabling network compression by adding the –compress 1 option to the ib_console command.
Optimizing Initiator CPU Utilization
In some projects, when there is high task parallelism, Incredibuild for Mac may cause high CPU consumption on the Initiator. If the number of Helper cores available for your build exceed the number of Initiator cores significantly, then the Initiator CPU may become the bottleneck for your build. If the Build Monitor shows Helper cores that are underutilized (i.e. there are blank gaps between the tasks running on these cores), but the Initiator cores are fully utilized (i.e. the CPU utilization graph is steadily at 100%), then it may be beneficial to instruct Incredibuild for Mac to reserve the Initiator cores for tasks that are not distributable (tasks that can only run locally). This may free up CPU cycles on the initiator and thus improve the efficiency and utilization of your Helper cores. To do this add the --force-remote option to the ib_console command.
Use Incredibuild Caching Rather than Ccache
Incredibuild for Mac comes with caching capabilities, integrated into its acceleration platform. This includes both local cache (a cache maintained per Initiator) and shared cache (where multiple Initiators contribute and benefit from a single shared cache).
If your build uses ccache, consider disabling that and using Incredibuild's Build Cache.