Me and my colleagues noticed a significant performance degradation during debug process. We use Xcode 12.5 and working on a large Swift app with 150+ modules. After migration to macOS 11.3-11.4, our application started to freeze on every dynamic linked library load.
First, we tried to research problem on our side, but with no success. Then we started to profile Xcode instruments (lldb and debugserver). I noticed that calling dyld SPI methods (
dyld_process_info_create() in debugserver) took the most of processor time during the app process freeze.
I made a special debugserver build with additional logging to OSLog and measured every
dyld_process_info_create() method call duration. I found out that every dynamic linked library load caused
dyld_process_info_create() method call with ~300ms duration, and this call caused app freeze. Dozens of such calls occurs when our applications are launched in debug mode, so app process are freezes for minutes.
As an experiment, we tried to profile the same dyld SPI calls on macOS 11.2.1, and
dyld_process_info_create() call takes only ~10ms. It is much faster and our app works normally.
Many other users also reported an issue: Xcode 12.5 very slow launch time f… | Apple Developer Forums
Some users also tried to reduce dyld SPI API call count: rG8dd106028b15
We used iOS simulator, but on iOS 14.6 problem is also reproduced. Unfortunately, I can't use custom debugserver build on iOS to prove.
DYLD SPI is a part of Darwin project, so I duplicated this report to Apple Feedback Assistant.