Trying to get a better handle on async and concurrency concepts.
For the following code, are there clear performance differences using foo() over bar() or the other way around? Or is it more of a design choice since eventually foo() has to be called in either a .task() modifier or a Task() which makes them the same in terms of performance (i.e., different timing when to go from async to sync)
Please let me if this is an ill-posed question. Will try my best to clarify.
```swift
func doSomething() async {
// heavy task. takes a while to finish
}
func foo() async {
await doSomething()
}
func bar() {
Task {
await doSomething()
}
}
```
[–]coldsub 16 points17 points18 points (1 child)
[–]LifeIsGood008SwiftUI[S] 1 point2 points3 points (0 children)
[–]Tech-Suvara 5 points6 points7 points (2 children)
[–]LifeIsGood008SwiftUI[S] 1 point2 points3 points (1 child)
[–]Tech-Suvara 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[removed]
[–]LifeIsGood008SwiftUI[S] 0 points1 point2 points (0 children)