# Using EnableSwiftBuildSystemIntegration on M1 Max vs M1 Ultra

**URL:** <https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319>\
**Category:** Using Swift\
**Created:** [March 29, 2022, 6:27pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319 "2022-03-29T18:27:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 29, 2022, 6:27pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/1 "2022-03-29T18:27:37Z")

</div>

`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.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [March 29, 2022, 7:28pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/2 "2022-03-29T19:28:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 29, 2022, 7:33pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/3 "2022-03-29T19:33:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 29, 2022, 7:38pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/4 "2022-03-29T19:38:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [March 29, 2022, 7:40pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/5 "2022-03-29T19:40:12Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 29, 2022, 7:41pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/6 "2022-03-29T19:41:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [March 29, 2022, 7:45pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/7 "2022-03-29T19:45:24Z")

</div>

You need to use something like [XCLogParser](https://github.com/MobileNativeFoundation/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.

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 29, 2022, 7:46pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/8 "2022-03-29T19:46:29Z")

</div>

Thank looks nice, thanks I'll take a look. I want to believe 😇

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 30, 2022, 6:01am UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/9 "2022-03-30T06:01:02Z")

</div>

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 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 30, 2022, 7:00am UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/10 "2022-03-30T07:00:31Z")

</div>

Some other data points:

[https://mjtsai.com/blog/2022/03/21/m1-ultra-mac-studio-compilation-benchmarks/](https://mjtsai.com/blog/2022/03/21/m1-ultra-mac-studio-compilation-benchmarks/)

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 30, 2022, 7:31am UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/11 "2022-03-30T07:31:59Z")

</div>

This seems to then corroborate with my findings - our project is 95% ObjC and 5% Swift. I'm seeing near zero gains - tried various other things.

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 30, 2022, 7:41am UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/12 "2022-03-30T07:41:07Z")

</div>

Well, if 95% of your code base is objective-c I’m not sure why you expect the 5% swift part to make such a big impact ([Amdahl's law - Wikipedia](https://en.wikipedia.org/wiki/Amdahl's_law)).

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 30, 2022, 7:42am UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/13 "2022-03-30T07:42:14Z")

</div>

I expect ObjC code to utilize the additional cores too, not just Swift. My bad this post is in a Swift Forum (😅).

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 30, 2022, 7:43am UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/14 "2022-03-30T07:43:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dmitriy\_Ignatyev](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dmitriy_ignatyev/32/11340_2.png) [@Dmitriy\_Ignatyev](https://forums.swift.org/u/Dmitriy_Ignatyev)\
**Post date:** [March 30, 2022, 1:27pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/15 "2022-03-30T13:27:49Z")

</div>

Try to play with:  
defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 20  
or  
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks `sysctl -n hw.ncpu`

May be current defaults limit the number of cores that can be used.

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 30, 2022, 2:18pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/16 "2022-03-30T14:18:53Z")

</div>

Sadly this does not help.

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 30, 2022, 4:49pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/17 "2022-03-30T16:49:20Z")

</div>

If you look at process monitor cpu history, how many cores are saturated during the build on the respective machines?

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 30, 2022, 8:52pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/18 "2022-03-30T20:52:18Z")

</div>

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`)

 ![Screenshot 2022-03-31 at 00.51.19@2x](https://global.discourse-cdn.com/swift/original/3X/c/9/c94306c099e81cda8d5c39a2d69cda2101ca2daa.png)

---

<div class="post-metadata">

**Author:** ![Fahad](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fahad/32/16096_2.png) [@Fahad](https://forums.swift.org/u/Fahad)\
**Post date:** [March 30, 2022, 9:05pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/19 "2022-03-30T21:05:07Z")

</div>

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.)

 ![Screenshot 2022-03-31 at 01.01.01@2x](https://global.discourse-cdn.com/swift/original/3X/1/6/16b219fc60b837fae486ca7d448fc00edff76d3c.png)

---

<div class="post-metadata">

**Author:** ![eleanorsp](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/eleanorsp/32/22966_2.png) [@eleanorsp](https://forums.swift.org/u/eleanorsp)\
**Post date:** [April 20, 2022, 3:35pm UTC](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319/20 "2022-04-20T15:35:07Z")

</div>

I'm seeing something very similar and [commented about it here](https://developer.apple.com/forums/thread/703986)

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!

[Next page](https://forums.swift.org/t/using-enableswiftbuildsystemintegration-on-m1-max-vs-m1-ultra/56319.md?page=2)
