Developer Community,
I've noticed a significant change in concurrent task execution behavior when testing on macOS 15 beta 4 & Xcode 16 Beta 4 compared to previous versions. Tasks that previously ran concurrently now appear to execute sequentially, impacting performance and potentially affecting apps relying on concurrent execution.
To illustrate this, I've created a simple toy example:
import SwiftUI
struct ContentView: View {
@State private var results: [String] = []
var body: some View {
VStack {
Button("Run Concurrent Tasks") {
results.removeAll()
runTasks()
}
ForEach(results, id: \.self) { result in
Text(result)
}
}
}
func runTasks() {
Task {
async let task1 = countingTask(name: "Task 1", target: 1000)
async let task2 = countingTask(name: "Task 2", target: 5000)
async let task3 = countingTask(name: "Task 3", target: 1500)
let allResults = await [task1, task2, task3]
results = allResults
}
}
func countingTask(name: String, target: Int) async -> String {
print("\(name) started")
var count = 0
for _ in 0..<target {
count += 1
}
print("\(name) finished. Count: \(count)")
return "\(name) completed. Count: \(count)"
}
}
Observed behavior (macOS 15 Beta 4 & Xcode 16 Beta 4):
Tasks appear to execute sequentially:
Task 1 started
Task 1 finished. Count: 1000
Task 2 started
Task 2 finished. Count: 5000
Task 3 started
Task 3 finished. Count: 1500
Expected behavior:
Tasks start almost simultaneously and finish based on their workload:
Task 1 started
Task 2 started
Task 3 started
Task 1 finished. Count: 1000
Task 3 finished. Count: 1500
Task 2 finished. Count: 5000
Observed behavior in macOS 15 Beta:
The profile reveals that the tasks are executing sequentially. This is evidenced by each task starting only after the previous one has completed.
Post
Replies
Boosts
Views
Activity
I hope this message finds you well. I recently had the opportunity to watch the insightful session titled "Improve Core ML Integration with Async Prediction" and was thoroughly impressed by the depth of information and the practical demonstration provided. The session offered valuable insights that I believe would greatly benefit my ongoing projects and my understanding of Core ML integration.
As I am keen on implementing the demonstrated workflows and techniques within my own work, I am reaching out to kindly request access to the source code and any related material presented during the session. Having access to the code would enable me to better understand the concepts discussed and apply them more effectively in real-world scenarios.
I believe that being able to review and experiment with the actual code would significantly enhance my learning experience and the implementation efficiency of my projects. It would also serve as a valuable resource for referencing best practices in Core ML integration and async prediction techniques.
Thank you very much for considering my request. I greatly appreciate the effort that went into creating such an informative session and am looking forward to potentially exploring the material in greater depth.
Best regards,
Fabio G.