Xcode 13.3 builds success but very slow

I built a project from my company by Xcode on my MacBook Air 2020 M1. I find the build time of Xcode 13.3 is 25x slower than 13.2.1 (990s vs 40s)!

I tried to remove 13.3 and reinstall 13.2.1 and built again (download from https://developer.apple.com/download/all/?q=xcode). Then, I upgraded Xcode to 13.3 again and built again. I confirm the slow time problem comes from Xcode 13.3.

I try to create a minimal example from the Xcode project. Unfortunately, the source files are still too big and can't be exposed publicly due to non-disclosure agreement of my company. However, I achieve a point: if I comment three lines of codes, the Xcode 13.3 build time reduces from 510s to 30s! Additionally, if I create a new project by Xcode 13.3, the build time is reasonable. Thus, I think the slow build time is specific to some Swift codes.

Please fix this Xcode bug.

Answered by ILikeTau in 709871022

Can you profile your build? Perhaps you're hitting https://bugs.swift.org/browse/SR-16027?

Accepted Answer

Can you profile your build? Perhaps you're hitting https://bugs.swift.org/browse/SR-16027?

Accepted Answer

Good news. It seems to that Xcode Version 13.4 (13F17a) has fixed this problem.