EnableSwiftBuildSystemIntegration did make some difference when turned on, for a large mixed ObjC+Swift project when testing this on a 10-Core M1 Max (MBP 16inch, 64 GB RAM).
I just tested the same project on a 20-Core Mac Studio M1 Ultra (128 GB RAM) and surprisingly the build times are exactly the same. No difference apart from +/- a couple of seconds.
Is this expected? I was really hoping the additional cores would get utilized and I'd see perhaps 50% reduction in build time, at least. A little disappointed but hoping this will improve.
What numbers are you actually seeing? From benchmarks Iāve seen, other build systems do get a 2x speed up on the Ultra, so at least it seems possible for Apple to reach expectations here.
My understanding is that most of those benchmarks are for GPU-heavy workloads; at least these do not mirror real-world Xcode usage.
For the same project, I'm seeing ~230 seconds "clean archive" time on a MBP (64 GB, M1 Max) while I'm seeing the same ~230 seconds on the new Mac Studio (128 GB, M1 Ultra).
I've by now tested this on one other fairly "large" mixed project, and build times are ~120 seconds on both. Near zero build time improvements as far as I can tell.
A "clean build" (not an archive) takes roughly 115 seconds on both machines for the same project, give or take a few seconds here and there.
I was hoping to see some improvement (ideally 1.5x) but I'm seeing zero.
There certainly must be room for improvement, given the machine itself is capable of doing better, but I don't see Xcode / Swift compiler utilize the extra cores for now - at least not for the type of mixed projects I've tested this on. I've tried clearing up DerivedData, performing clean builds, waiting for indexing to finish etc but unfortunately a bit disappointed.
Even incremental build times are exactly the same (for minor code changes) - I see 30 seconds on the MBP and 30 seconds on the M1 Ultra for the same changes. I was hoping incremental builds would be at least 1.5x faster (accounting for digital friction) but nope.
My understanding is that most of those benchmarks are for GPU-heavy workloads; at least these do not mirror real-world Xcode usage.
No, various benchmarks for other builds, like WebKit, or cmake or ninja builds, show the 2x improvement.
You may want to investigate where your build time is being spent. Zero improvement is unexpected and doesnāt match other Xcode benchmarks Iāve seen.
Sure - but even if build time was spent copying / moving files in a post build phase, I should still see some difference as the times would have offset by faster compilation of actual code. I'm literally seeing the same times.
I know - I'm underwhelmed myself at this point, trying to see if there's something I can tweak, play with, but so far no such luck.
You need to use something like XCLogParser to see where your time is being spent. Since your results are out of line with others, thereās probably something up with your build.
Both projects seem to show that itās taking that long to build the products / large number of SPMs it depends upon. At first glance thereās nothing glaringly obvious that the build is otherwise āhungā on.
Again, Iām perplexed why Iām seeing absolutely zero gains across two completely different projects - same build times. Sure I could now instead spend time trying to perhaps find ways to speed up builds in general but I donāt see why compilation itself did not speed up across the 10 cores vs 20 cores.
Iāll continue hunting but it really feels as though Xcode for some odd reason isnāt utilizing the additional cores for me.
Side note: every single time I upgraded my hardware over the last 10 years, I would see the gains. Especially from the i9 to the M1 Max. Immediate results. However from the M1 Max to the Ultra it looks as though itās stuck using the same number of cores / threads / build processes somehow and capped at the speed of a single core (times however many itās actually utilizing on both).
Maybe there are some user defaults Xcode is configured with that are messing things up, given I transferred my data using the migration tool. I could try and delete Xcode entirely, wipe out the user defaults and install again
Sorry - I should add that although the 5% of Swift is part of the main app, the majority of SPMs we use (15+) are 95% Swift. I don't see much gains there too. Again, I should have seen some difference, but the build times remain the same.
Most of the times (for most operations, such as checking out git repos, SPMs etc) Xcode seems to only by utilizing the 4 efficiency cores. The 16 performance cores are doing nothing.
When I perform a xcodebuild archive, I see all 20 cores fire up (Activity Panel > CPU History) so it looks like they're being utilized - they come and go though, in between I only see the efficiency cores kick in. What is bothering me is that I'm seeing no improvements in overall compilation time.
I've spent a day trying to optimize build times but have gotten nowhere. I'm going to stop now, assuming this will improve with future xcode updates ĀÆ\(ć)/ĀÆ
Here's what I see (taken in the middle of an archive)
This is an interesting graph. You can see all cores being utilized - this is when Xcode was indexing in the background (nothing being built actively). Once it finished indexing, I started the build and saw core utilization drop across all performance cores (near the middle of the graph). Only the efficiency cores plus a few performance cores are seen being utilized (I've noticed that for most things in Xcode, only the 4 efficiency cores are utilized. I would have thought for a desktop mac with unlimited power draw, it would prefer using the performance cores.)
However I am noticing the ObjC compilations are simply much slower. On my Ultra Studio a typical file is taking between 5 seconds and 7 seconds per file!!, whereas on the MBP (Pro) the same files are taking 0.7 and 1.2 seconds. So overall my total build is slower on the Ultra vs MBP. After investigating all the possible compilation settings I could only assume its something to do with all the -I includes (there are over 2500 per file). Since my project is around 10% Swift, I see there is no discernible difference with this flag, but given the major issue is with ObjC it was not unexpected!