Git Product home page Git Product logo

concurrencytest's Introduction

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

concurrencytest's People

Contributors

akbashev avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.