Skip to content

akbashev/ConcurrencyTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift Package Manager iOS iOS version macOS macOS version

ConcurrencyTest

Requirements

Works on iOS 17 and macOS 14. Just open ConcurrencyTest.xcodeproj in App folder with Xcode and run the app.

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

Results

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.

Footnotes

  1. Custom thread is just a simple wrapper arround OperationQueue with maxConcurrentOperationCount=1

  2. Custom exector uses custom thread to enqueue job. 2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages