XcodeBenchmark
XcodeBenchmark copied to clipboard
Build is mush faster after increasing task concurrency count (58 seconds on M1 Ultra)
I have a Mac Studio 2022, M1 Ultra, 64GB, 1TB SDD machine.
Before altering the xcodebuild's default task concurrency settings, the benchmark result is close to others' 68 seconds, but after increasing the task concurrency count with following commands, the result is about 15% better,
defaults write com.apple.dt.xcodebuild PBXNumberOfParallelBuildSubtasks 128
defaults write com.apple.dt.xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 128
defaults write com.apple.dt.Xcode PBXNumberOfParallelBuildSubtasks 128
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 128
I can get 58 seconds result on the same M1 Ultra machine:

Can this be considered a valid record?
Hi @Naituw,
Thank you for mentioning this!
While this does improve the build time on M1 Ultra, these settings look device/project-specific.
I tried both options (but used the following values 10, 20, and 40) on my M1 Pro (10 cores, 32 GB memory), and the build time has not changed 😢
By the way, does M1 Ultra have the High Power Mode?
If yes, could you please share the output of pmset -g?
Thanks!
As far as I know, there is no High Power Mode on the Ultra.

And pmset -g:

There's also a new build option for optimizing multi-core CPUs in Xcode 13.3 (see release notes) defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
I am using Xcode 13.3 and testing on M1 Max 32GB ram. What I find surprising is that compilation via sh script takes 93seconds, however, when I open this project in Xcode, clean it, and building same scheme(XcodeBenchmark) as in script for any ios device arm64, the result is 67seconds. That would be as fast as Ultra, and that does not make sense, right?
Hi @jurajantas
Could you confirm that you removed Derived Data before running a test in Xcode?
@devMEremenko No, I did not. 67sec just with cleaning the project and build. So let's test it. Now I did also explicitly removed derived data, got 77seconds. Still faster than 93seconds. I don't fully understand why is that. I would expect that sh script and build from inside xcode produce same result time-wise, but that is not the case.
Also tested: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 but that has no effect on the result at all. Unfortunately.
time to compile with sh script is 97sec, time to compile inside xcode 13.3 without explicitly deleting derived data is 67sec, time to compile inside xcode 13.3 with explicitly deleting derived data is 77sec.
Best I ever got with sh script was 93sec, but that is probably outlier, it most often oscillates around 97sec.