Loop icon indicating copy to clipboard operation
Loop copied to clipboard

Xcode 16 Builds very slowly

Open marionbarker opened this issue 4 months ago • 2 comments

Describe the bug

Initial builds with Xcode 16 are significantly (many minutes) slower than with Xcode 15. This happens for a new clone and any time an existing clone is reset using Product->Clean Build folder.

Configuration

Build times reported in this Issue were obtained with

  • LoopWorkspace dev, commit a32a19d (3.5.0)
  • Apple M1 MacBook Pro
  • Xcode 16.0
  • macOS 14.6

Previous Information

The initial discussion of this topic is on zulipchat:

  • https://loop.zulipchat.com/#narrow/stream/144182-development/topic/Xcode.2016.20Slow.20Builds

The gist is that when this parameter, ENABLE_MODULE_VERIFIER is set to YES in the project.pbxproj file, the initial build takes a long time with Xcode 16.

Additional Information

There are 19 submodules used by LoopWorkspace 3.4.1 and 3.5.0.

Of those, only 6 submodules have the ENABLE_MODULE_VERIFIER set in the Debug and Release sections and in all cases, it is set to YES. The number of entries in the project.pbxproj file per submodule is shown in the table below.

Repo Instances
AmplitudeService 4
LibreTransmitter 4
LoopKit 7
MixpanelService 6
OmniBLE 2
OmniKit 6

Suggested Fix

There are 2 suggestions for fixing this problem.

  1. Change the instances of that configuration from YES to a parameter that defaults to NO but could be modified to change the value without modifying the submodules again.
  2. Remove the lines with that parameter in the project.pbxproj files completely

The rationale for Option 1 is that someone turned these on and there may be a reason why this was done.

The rationale for Option 2 is to be consistent with all the other submodules.

Both these options were tested and the improved timing is identical for either choice so long as the 12 instances of ENABLE_MODULE_VERIFIER = YES that matter are modified.

Timing Data

The timing for the build is taken from the Xcode tool.

  • All tests with Xcode 16.0
  • All initial builds preceded by Clean Build Folder, close workspace, open workspace
  • Use the menu sequence: Product, Perform Action, Build with Timing Summary
  • All times are reported in seconds
  • View the Build Timing Summary display

Report build time in seconds for first and subsequent builds in the table below. Multiple tests of a given configuration gave consistent results.

Config First Build Next Build
dev 490 20
modified 140 20

Timing Display for Initial Build: dev

The graphic below shows the timing display associated with the ENABLE_MODULE_VERIFIER = YES parameter for the initial build for Loop 3.4.1 or 3.5.0.

timing-summary-for-dev

The items in the graphic above that begin with "Verify" are shown in the list below.

  1. LoopKit
  2. LoopKit-watchOS
  3. LoopKitUI
  4. AmplitudeService
  5. AmplitudeServiceUIKit
  6. MixpanelService
  7. MixpanelServiceUI
  8. OmniKit
  9. OmniKitUI
  10. OmniBLE
  11. LibreTransmitter
  12. LibreTransmitterUI

Timing Display for Initial Build: fix applied

The graphic below shows the timing display for the initial build when the submodules have the suggested fix applied.

timing-summary-update

marionbarker avatar Oct 02 '24 03:10 marionbarker