Git Product home page Git Product logo

Comments (4)

sobri909 avatar sobri909 commented on May 20, 2024

So I've just discovered that iOS 12 is killing Arc on newer model phones after as few as 4 seconds of processing in the background.

https://twitter.com/sobri/status/1059130940616634368?s=21

Which is ... well, I have very impolite words to say about that. Very impolite words indeed. That is Very Uncool of Apple. It is not cricket. If I had an Apple engineer within awkward confrontation reach right now, we would be having an awkward confrontation.

Anyway, that means that for background processing tasks to survive they are going to have to be micromanaged down to the second, taking into account how many cores (threads) they are being spread over during each second of the task. The energy consumption micromanagement task complexity just went through the roof.

All of that means that this task just went from being "fun thing to work on later" to being top priority, and also requiring considerably more complexity than I'd planned. So I'll be working on this tomorrow. Whilst saying angry things that are best not typed.

Uncool Apple. Uncool.

from locokit.

sobri909 avatar sobri909 commented on May 20, 2024

Hunting through the energy reports further, it really does look like this is an iOS 12 bug. It is punishing multithreaded code on newer model devices that have more cores. Older phones are surviving fine because they've got less cores.

iOS 12 shouldn't be punishing apps for running more efficiently on newer devices. There's no sense to that. So yeah, I smell an iOS bug.

So perhaps I should be reporting this to Apple. Although I loathe going down the Radar sarlacc unless absolutely necessary.

I'm also not able to clearly see the individual threads in Xcode's energy stack traces. It looks like it's showing the trace of a single thread, but ... it can't be. It's not possible to get 1200% CPU consumption from a single thread (or if it is, I will be very surprised), so there's definitely more to the story here that I'm going to have to piece together tomorrow. Sigh.

from locokit.

sobri909 avatar sobri909 commented on May 20, 2024

Goals

  • Optimise for speed and parallelism in foreground
  • All background tasks must be done at .background priority
  • All background tasks must be done strictly in serial (parallelism will trigger the iOS 12 bug)
  • Ensure that current serial queues still have their serial nature enforced

Todos

  • Serial processing queue
  • Parallel processing queue
  • Parallel queue reduced to serial while in background
  • Parallel queue suspended in background while serial queue not empty
  • Pending operations on both queues reprioritised to .background on entering background
  • Compulsory 60 second pauses between serial operations in background
  • Logging of operation durations (to raise awareness of potential >60 second tasks)
  • Don't pause the serial queue while in recording mode
  • Deduplicate the queue pause code (there's still a race condition)
  • 60 second gap is getting shortened due to above race condition
  • Add serial queue jobs at higher priority in foreground
  • Send a notification when a job runs for longer than 60 seconds
  • Spare a thought for queuePriority, because it might have some immediate use
  • Collate queue statistics, for more nuanced job management, and debug logging
  • Investigate background resource consumption monitoring possibilities

from locokit.

sobri909 avatar sobri909 commented on May 20, 2024

I've merged this into develop now. It's proven stable in Arc 2.2.14 and 2.2.15.

There's a few more things I want to do with it, but they aren't urgent.

from locokit.

Related Issues (20)

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.