Comments (4)
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.
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.
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.
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)
- Xcode 11, Swift 5.1 HOT 2
- The necessary unit tests should be created HOT 5
- Couldn't build LocoKit Develop branch with Xcode 11.2 HOT 1
- Couldn't build LocoKit Develop branch with Xcode 11.3 HOT 1
- Unable to build in Swift 5 HOT 1
- Battery usage optimization HOT 1
- Is TimelineManager still available? HOT 5
- LocoKit won't build on Apple Silicon Macs HOT 6
- LocoKit SPM resolve warning HOT 2
- ClassifierResults only returns one value: Car HOT 2
- Getting Only stationary activityType from most recent TimelineItem HOT 3
- Deleting TimelineItems HOT 5
- Xcode 13 / Swift 5.5 compatible LocoKitCore HOT 4
- Question for Histogram.probabilityFor HOT 2
- Latest 3.9.1 with iOS 16.4.1 extreme battery drain HOT 4
- Xcode 14.1 Simulator don't build
- Machine Learning Classifiers HOT 1
- The positioning will be erratic at night HOT 8
- LocoKit Service / server EOL announcement
- Activity types detection doesn't work out of the box. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from locokit.