XcodeBenchmark icon indicating copy to clipboard operation
XcodeBenchmark copied to clipboard

Benchmarks using latest Xcode 13.2 beta `EnableSwiftBuildSystemIntegration`

Open AvdLee opened this issue 3 years ago • 16 comments

The build system and Swift compiler in Xcode 13.2 beta 2 have a new mode that better utilizes available cores, resulting in faster builds for Swift projects. The mode is opt-in, and you can enable globally with the following user default:

defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1

It would be great to see updates on the benchmarks with this setting enabled!

AvdLee avatar Nov 16 '21 20:11 AvdLee

Since Xcode normally doesn't use more than 4 cores efficiently, I'm curious if we'd see less than 4 core Macs have an improvement. M1 Macs probably won't have as much of an improvement as M1 Pro/Max

EthanLipnik avatar Nov 16 '21 21:11 EthanLipnik

Just ran it on a 14" M1 Max with 64 GB RAM. EnableSwiftBuildSystemIntegration 0: 95.028s EnableSwiftBuildSystemIntegration 1: 91.010s Can create a PR if desired, but unsure how this would be integrated in the list's current structure? @devMEremenko could you provide guidance?

alexfringes avatar Nov 16 '21 22:11 alexfringes

Just ran this on M1 Mac mini, 16Gb. Also got around a 5% speedup from 130s to 124s. I've found this benchmark is consistently @ 130s on this configuration, so that's the fastest time I've seen so far.

paulfreeman avatar Nov 17 '21 10:11 paulfreeman

I would love to get insights into how the available cores make a difference, since that can be a differentiator for buying one or another MacBook 🤔

AvdLee avatar Nov 17 '21 16:11 AvdLee

FWIW, after working with this mode enabled for a day, I've noticed that incremental builds seemingly have gotten slower, to the extent that the gains on broader builds are outweighed in (my) everyday workflow. A quick test seems to support this feeling. Toggling on the new build mode reliably more than doubles the build time of a small change (one string changed in a file that only a handful of other files depend on) from 4s to 10s. Will file a feedback & post in the dev forums in a bit.

alexfringes avatar Nov 18 '21 04:11 alexfringes

Yes this is definitely happening @alexfringes, incremental builds are taking 30s on my own project now with zero changes. So fun for a benchmark but useless in general. I notice that in my case one dependency in particular is recompiled every time, but all the rest are not, so this seems to be work in progress.

paulfreeman avatar Nov 18 '21 15:11 paulfreeman

Terminal_XcodeBenchmark — -zsh — 140×29 - 2021-11-18 at 15 02 47

Similar results for me on M1 Max, 64GB, 16"

earltedly avatar Nov 18 '21 15:11 earltedly

I'm seeing numbers that i'm having a hard time trusting with the flag enabled. ran the benchmark 3 times and getting the same results though.

Screenshot 2021-11-23 at 2 02 43 AM Screenshot 2021-11-23 at 2 04 14 AM Screenshot 2021-11-23 at 2 05 56 AM

euwars avatar Nov 23 '21 01:11 euwars

I'm seeing numbers that i'm having a hard time trusting with the flag enabled. ran the benchmark 3 times and getting the same results though.

You should be able to verify if the flag got applied to the build by checking the build log for Swift build system integration enabled..

BenchR267 avatar Nov 29 '21 08:11 BenchR267

Can anyone confirm if Xcode 13.2 RC fixes the incremental build issue?

EthanLipnik avatar Dec 07 '21 18:12 EthanLipnik

@AvdLee #282 #283 #284 😉

florentmorin avatar Dec 12 '21 17:12 florentmorin

Hi all, I'm trying this new option with official Xcode 13.2.

With Swift build system integrated disabled:

Small project, with Xcode for M1: The first build time is 27 seconds second build time 6 seconds Later builds 0.3 seconds

A complex project, with Xcode under rosetta:

  • The first build 204 seconds
  • Second build 54 seconds
  • Others builds 1 second

With Swift build system integrated enabled:

Small project, with Xcode for M1:

  • The first build 27 seconds
  • Second build 6 seconds
  • Other builds 6 seconds

A complex project, with Xcode under rosetta:

  • The first build 214 seconds
  • Second build 60 seconds
  • Later builds 60 seconds

Practically with Swift build system integrated enabled, the first build is similar if not slower and all subsequent ones are much slower. How do you think this is possible?

I used a MacBook Pro 16 'M1Max 32Gb Ram.

SalvoSwift21 avatar Dec 14 '21 23:12 SalvoSwift21

@SalvoSwift21 This option is really new and optimized for large projects. It's the reason why it can be disabled. Today, Apple teams need feedbacks from community projects to improve it.

florentmorin avatar Dec 15 '21 06:12 florentmorin

Ok @florentmorin thanks a lot for the answer, I thought it could already be used with smaller projects as well. Could I do something to help the apple team with these tests?

SalvoSwift21 avatar Dec 15 '21 08:12 SalvoSwift21

@SalvoSwift21 Yes, you can. Simply send a feedback with a sample code using Feedback Assistant.

florentmorin avatar Dec 15 '21 08:12 florentmorin

Ok @florentmorin, thanks I opened the feedback let's see what they answer.

SalvoSwift21 avatar Dec 15 '21 08:12 SalvoSwift21