Skip to content

FB11020478 - Xcode 14 incremental builds are all serial #841

@chiragramani

Description

@chiragramani

FB11020478 - Xcode 14 incremental builds are all serial(expecting parallel wherever applicable)

We have enclosed the Xcode project("SerialReproducer.zip") and a video("Xcode14-repro.mov") demonstrating the issue in this ticket. (Repro1 as well as Repro 2).

Attachments:

  1. Xcode14-repro.mov
  2. SerialReproducer.zip

Setup:
The Xcode project was created from the latest Xcode Version 14.0.
In the reproducer, there are 5 libraries - LibA, LibB, LibC, LibD, LibE.

Scenario:

  1. LibA, LibB, LibC, LibD → all depend on LibE.
  2. This means if there are changes in LibE, it should trigger a recompilation of files in LibA, LibB, LibC, LibD targets.
  3. Since LibA, LibB, LibC, LibD targets are disjoint from each other, they should compile in parallel.

Repro1: Repro to get all serial incremental builds:

  1. Select the scheme: "All".
  2. Do a clean build. Notice LibA-LibD targets are compiled in parallel.
  3. Now, make any changes in "LibE.swift". It can be adding a new class or struct, any meaningful change inside Xcode.
  4. Build the Scheme "All".
  5. Notice that targets: LibA, LibB, LibC, LibD follow a serial compilation sequence. Ideally, LibA-LibD should compile in parallel in the same way as they were compiled in the Clean Build case.
  6. Make any change in LibE.swift and you will always see serial incremental builds for all successive changes/invocations.

But this is not always the case. The new build system in Xcode 14 does give parallel builds under a very special edge-case.

Repro2: Repro to get parallel builds:

  1. Follow the steps in "Repro1" to setup the initial state.
  2. Now make a change in LibA.swift, LibB.swift, LibC.swift, LibD.swift, LibE.swift.(it can be commenting out code, adding a new class etc) Notice: we have made changes to all the files that are a part of the compilation sequence.
  3. Now build the scheme: "All".
  4. Notice that the parallel incremental builds are back. We can see from the Xcode's assistant build timeline that LibA, LibB, LibC, LibD are being compiled in parallel.
  5. Now, make any change just in "LibE.swift". It can be adding a new class, anything.
  6. Build the scheme and notice that LibA-LibD are compiled in parallel.
  7. We now get parallel builds for all the successive changes in LibE.swift.
  8. This initially in Repro 1 was only giving serial builds for the exact same change. Maybe there is a state that is missing in the initial incremental build and that's why it's all serial.

For any medium to large projects, not getting parallel incremental builds brings a significant regression that will be affecting the developer experience. Can the fix be prioritized and are there any workarounds that we can explore till the fix lands in an Xcode 14 release?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions