Maximum number of threads with async-await task groups

This limitation on the cooperative thread pool on the simulator has been removed in Xcode 14.3 (without any mention to this change in the release notes).

It looks like this curious behavior is a limitation of the simulator in Xcode 14.2 and earlier. If I run it on my physical iPhone 12 Pro Max, the async-await task group approach results in 6 concurrent tasks …

enter image description here

… which is essentially the same as the concurrentPerform behavior:

enter image description here

The behavior, including the degree of concurrency, is essentially the same on the physical device.

One is left to infer that the simulator appears to be configured to constrain async-await more than what is achievable with direct GCD calls. But on actual physical devices, the async-await task group behavior is as one would expect.

For what it is worth, the above was produced by Xcode 13 on MacBook Pro. I have repeated this on two different Macs in Xcode 14.2 and got different results. Specifically, on my Intel 2018 MacBook Pro the cooperative thread pool for my simulator had two threads. On my 2022 Mac Studio, though, it was constrained to 3 threads:

enter image description here

It would appear that the size of the simulator’s cooperative thread pool is affected by the Mac hardware you use. But the point remains, that the cooperative thread pool is artificially constrained on the simulator.

For comparison, here is a comparable “Points of Interest” run on a physical iPhone 12 Pro Max in Xcode 14.2:

enter image description here

Leave a Comment