Works on iOS 17 and macOS 14. Just open ConcurrencyTest.xcodeproj
in App
folder with Xcode and run the app.
Simple test to check different concurrency strategies in Swift when an app have high CPU load. Examples are:
- Run on main thread
- Run on custom thread1
- Run using regular async/await
- Run using simple actor
- Run using an actor with worker pool pattern
- High cpu loader is an actor with custom executor2
- Run using an actor with worker pool pattern, where each worker is high cpu loader actor with custom executor2
Screenshots of the app and CPU usage:
On the left it's regular async/actor stuff. It's actually quite heavy and even makes M1 life a bit hard. You can notice it when running an app on macOS and sending app to background and back again. On the right it's 2 workers with custom threads, it takes longer to run execution, but everything is completely smooth.