Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB11020478 - Xcode 14 incremental builds are all serial #841

Open
chiragramani opened this issue Aug 29, 2022 · 6 comments
Open

FB11020478 - Xcode 14 incremental builds are all serial #841

chiragramani opened this issue Aug 29, 2022 · 6 comments

Comments

@chiragramani
Copy link

chiragramani commented Aug 29, 2022

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?

@chiragramani
Copy link
Author

cc: @aciidb0mb3r

@chiragramani
Copy link
Author

Hey @erikolofsson, I see that you have a PR that talks about Parallel Incremental Builds (#832). Can you confirm if it's related to the above issue?

@dmbryson
Copy link
Collaborator

Yes, I believe that it is related to the above.

@dmbryson
Copy link
Collaborator

Above PR was merged.

@alanzeino
Copy link

Should this be reopened @dmbryson since the PR was reverted and this issue continues in Xcode 14.3.1?

@dmbryson dmbryson reopened this Jun 6, 2023
@chiragramani
Copy link
Author

@dmbryson any updates/workarounds related to this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants