writing energy efficient code - apple inc. · 2016-07-08 · writing energy efficient code part 2...
TRANSCRIPT
![Page 1: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/1.jpg)
© 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
#WWDC14
Writing Energy Efficient CodePart 2
Session 712 Albert Liu iOS Software Power Engineer
Core OS
![Page 2: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/2.jpg)
![Page 3: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/3.jpg)
![Page 4: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/4.jpg)
Agenda
Quick Recap
Energy Efficient Networking
Measuring Impact
Sleep
Final Thoughts
![Page 5: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/5.jpg)
Quick Recap
![Page 6: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/6.jpg)
Energy 101Minimizing overhead cost
Time
Pow
er
Idle power
Dynamic cost
Fixed cost
Intermediate statesResource costYour work
![Page 7: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/7.jpg)
Single-Threaded Multi-Threaded
Energy 101Trading power for energy
Time
Pow
er
Resource costYour work
![Page 8: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/8.jpg)
Reducing Energy UseWhat it comes down to…
Do it never
Do it at a better time
Do it more efficiently
Do it less
![Page 9: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/9.jpg)
Energy Efficient CodingOptimizing CPU usage
![Page 10: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/10.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never
![Page 11: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/11.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never• Stop unnecessary work on app transitions
![Page 12: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/12.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never• Stop unnecessary work on app transitions
Do it at a better time
![Page 13: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/13.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never• Stop unnecessary work on app transitions
Do it at a better time• Scheduling with NSBackgroundActivityScheduler / NSURLSession
![Page 14: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/14.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never• Stop unnecessary work on app transitions
Do it at a better time• Scheduling with NSBackgroundActivityScheduler / NSURLSession
Do it more efficiently
![Page 15: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/15.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never• Stop unnecessary work on app transitions
Do it at a better time• Scheduling with NSBackgroundActivityScheduler / NSURLSession
Do it more efficiently• Set appropriate QoS work priorities
![Page 16: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/16.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never• Stop unnecessary work on app transitions
Do it at a better time• Scheduling with NSBackgroundActivityScheduler / NSURLSession
Do it more efficiently• Set appropriate QoS work priorities
Do it less
![Page 17: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/17.jpg)
Energy Efficient CodingOptimizing CPU usage
Do it never• Stop unnecessary work on app transitions
Do it at a better time• Scheduling with NSBackgroundActivityScheduler / NSURLSession
Do it more efficiently• Set appropriate QoS work priorities
Do it less• Coalesce timers => let CPU idle
![Page 18: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/18.jpg)
CPU MonitorRunaway background usage
New in iOS 8
Background applications • Termination when runaway usage is detected
• EXC_RESOURCE : CPU_FATAL Crash log
![Page 19: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/19.jpg)
CPU MonitorRunaway background usage
![Page 20: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/20.jpg)
CPU MonitorRunaway background usage
![Page 21: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/21.jpg)
CPU MonitorRunaway background usage
![Page 22: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/22.jpg)
Energy Efficient CodingGraphics and Animations
![Page 23: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/23.jpg)
Energy Efficient CodingGraphics and Animations
Avoid extraneous screen updates
![Page 24: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/24.jpg)
Energy Efficient CodingGraphics and Animations
Avoid extraneous screen updates
Review blur effect usage • Reduce frame changes behind blurs
![Page 25: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/25.jpg)
Agenda
Quick Recap
Energy Efficient Networking
Measuring Impact
Sleep
Final Thoughts
![Page 26: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/26.jpg)
Energy Efficient Networking
![Page 27: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/27.jpg)
Web Server Application
Requirements • Sync data to server
![Page 28: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/28.jpg)
Web Server Application
Current solution • Sync data as it comes
![Page 29: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/29.jpg)
Web Server Application
Current solution • Sync data as it comes
![Page 30: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/30.jpg)
Network EnergyOverhead cost
Data syncs
Time
Pow
er
![Page 31: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/31.jpg)
Network EnergyOverhead cost
Radio costData syncs
Time
Pow
er
Dynamic cost
Overhead cost
![Page 32: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/32.jpg)
Network EnergyWeb browsing
![Page 33: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/33.jpg)
Network EnergyWeb browsing
iPhone 5S • Wifi—10 hours
• 3G—8 hours
![Page 34: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/34.jpg)
Network EnergyAll things are NOT created equal
![Page 35: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/35.jpg)
Network EnergyAll things are NOT created equal
Cellular vs. Wi-Fi
Signal conditions
Network throughput
![Page 36: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/36.jpg)
Webserver Application
Current solution • Buffer data before syncing
![Page 37: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/37.jpg)
Webserver Application
Current solution • Buffer data before syncing
![Page 38: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/38.jpg)
Network Energy
Radio costData syncs
Time
Pow
er
![Page 39: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/39.jpg)
Network Energy
Radio costData syncs
Time
Pow
er
![Page 40: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/40.jpg)
Energy Efficient NetworkingConcepts to remember
![Page 41: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/41.jpg)
Energy Efficient NetworkingConcepts to remember
Doing it more efficiently• Coalesce Transactions
![Page 42: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/42.jpg)
Energy Efficient NetworkingConcepts to remember
Doing it more efficiently• Coalesce Transactions
Doing it less/never• Cut down Transfers
![Page 43: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/43.jpg)
Cut Down/TransfersDoing it never/less
![Page 44: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/44.jpg)
Cut Down/TransfersDoing it never/less
Reduce data sizes • Reduce media quality
• Compress your data
![Page 45: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/45.jpg)
Cut Down/TransfersDoing it never/less
Reduce data sizes • Reduce media quality
• Compress your data
Avoid redundant transfers• Caching
• Resumable transactions
![Page 46: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/46.jpg)
Cut Down/TransfersDoing it never/less
Reduce data sizes • Reduce media quality
• Compress your data
Avoid redundant transfers• Caching
• Resumable transactions
Handle errors• Timeout
• Retry policies
![Page 47: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/47.jpg)
Energy Efficient NetworkingConcepts to remember
Doing it more efficiently • Coalesce Transactions
Doing it less/never • Cut down Transfers
Doing it at a better time • Consider Tolerance
![Page 48: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/48.jpg)
Consider ToleranceDoing it at a better time
Understand requirements • When is it needed?
Consider • Technology used
• Network conditions
![Page 49: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/49.jpg)
Webserver Application
Current solution • Buffer data before syncing
![Page 50: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/50.jpg)
Webserver Application
Current solution • Buffer data before syncing
• Check data before buffer
![Page 51: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/51.jpg)
Webserver Application
Current solution • Buffer data before syncing
• Check data before buffer
![Page 52: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/52.jpg)
Webserver Application
Current solution • Buffer data before syncing
• Check data before buffer
• Sync on good signal conditions
![Page 53: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/53.jpg)
Webserver Application
Current solution • Buffer data before syncing
• Check data before buffer
• Sync on good signal conditions
![Page 54: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/54.jpg)
Webserver Application
Current solution • Buffer data before syncing
• Check data before buffer
• Sync on good signal conditions
![Page 55: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/55.jpg)
NSURLSessionNetworking API
![Page 56: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/56.jpg)
NSURLSessionNetworking API
Pause/Resume
![Page 57: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/57.jpg)
NSURLSessionNetworking API
Pause/Resume
Cache per session
![Page 58: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/58.jpg)
NSURLSessionNetworking API
Pause/Resume
Cache per session
Background sessions
![Page 59: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/59.jpg)
NSURLSessionNetworking API
Pause/Resume
Cache per session
Background sessions• Out of process transactions
![Page 60: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/60.jpg)
NSURLSessionNetworking API
Pause/Resume
Cache per session
Background sessions• Out of process transactions
• Throughput monitoring
![Page 61: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/61.jpg)
NSURLSessionNetworking API
Pause/Resume
Cache per session
Background sessions• Out of process transactions
• Throughput monitoring
• Automatic retries
![Page 62: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/62.jpg)
NSURLSessionDiscretionary tasks
![Page 63: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/63.jpg)
NSURLSessionDiscretionary tasks
Available for background sessions
![Page 64: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/64.jpg)
NSURLSessionDiscretionary tasks
Available for background sessions
Power optimal system scheduling
![Page 65: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/65.jpg)
NSURLSessionDiscretionary tasks
Available for background sessions
Power optimal system scheduling
Adjustable scheduling window
![Page 66: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/66.jpg)
NSURLSessionDiscretionary tasks
Available for background sessions
Power optimal system scheduling
Adjustable scheduling window• configuration.timeoutIntervalForResource // should be > 12 hours
![Page 67: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/67.jpg)
NSURLSessionDiscretionary tasks
Available for background sessions
Power optimal system scheduling
Adjustable scheduling window• configuration.timeoutIntervalForResource // should be > 12 hours
• Error will be thrown if conditions are not met
![Page 68: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/68.jpg)
NSURLSession
NSURLSessionConfiguration *config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@“com.apple.App.UserRestore”]; [config setAllowsCellularAccess:NO]; [config setDiscretionary:YES]; config.timeoutIntervalForResource = 18 * 60 * 60; !
NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil]; !
NSURL *url = [NSURL URLWithString:@“http://www.foo.com/interesting_thing”]; NSURLSessionTask *task = [session downloadTaskWithURL:url]; [task resume];
![Page 69: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/69.jpg)
NSURLSession
NSURLSessionConfiguration *config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@“com.apple.App.UserRestore”]; [config setAllowsCellularAccess:NO]; [config setDiscretionary:YES]; config.timeoutIntervalForResource = 18 * 60 * 60; !
NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil]; !
NSURL *url = [NSURL URLWithString:@“http://www.foo.com/interesting_thing”]; NSURLSessionTask *task = [session downloadTaskWithURL:url]; [task resume];
![Page 70: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/70.jpg)
NSURLSession
NSURLSessionConfiguration *config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@“com.apple.App.UserRestore”]; [config setAllowsCellularAccess:NO]; [config setDiscretionary:YES]; config.timeoutIntervalForResource = 18 * 60 * 60; !
NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil]; !
NSURL *url = [NSURL URLWithString:@“http://www.foo.com/interesting_thing”]; NSURLSessionTask *task = [session downloadTaskWithURL:url]; [task resume];
![Page 71: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/71.jpg)
Energy Efficient NetworkingConcepts to remember
Doing it more efficiently • Coalesce Transactions
Doing it less/never • Cut down Transfers
Doing it at a better time • Consider Tolerance
![Page 72: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/72.jpg)
Agenda
Quick Recap
Energy Efficient Networking
Measuring Impact
Sleep
Final Thoughts
![Page 73: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/73.jpg)
Measuring Impact
![Page 74: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/74.jpg)
Xcode
![Page 75: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/75.jpg)
Xcode
![Page 76: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/76.jpg)
Energy Diagnostics
![Page 77: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/77.jpg)
Energy Diagnostics
![Page 78: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/78.jpg)
Energy Diagnostics
![Page 79: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/79.jpg)
Energy Diagnostics
![Page 80: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/80.jpg)
Energy Diagnostics
![Page 81: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/81.jpg)
Energy Diagnostics
![Page 82: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/82.jpg)
DemoEnergy diagnostics
![Page 83: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/83.jpg)
Agenda
Quick Recap
Energy Efficient Networking
Measuring Impact
Sleep
Final Thoughts
![Page 84: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/84.jpg)
Sleep
![Page 85: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/85.jpg)
“To sleep is to prepare for the longer journey ahead…”
![Page 86: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/86.jpg)
SleepLet the device sleep
![Page 87: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/87.jpg)
SleepLet the device sleep
Battery life depends on sleep
![Page 88: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/88.jpg)
SleepLet the device sleep
Battery life depends on sleep
iPhone 5S
![Page 89: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/89.jpg)
SleepLet the device sleep
Battery life depends on sleep
iPhone 5S• Web browsing—about 8 to 10 hours
![Page 90: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/90.jpg)
SleepLet the device sleep
Battery life depends on sleep
iPhone 5S• Web browsing—about 8 to 10 hours
• Audio—about 40 hours
![Page 91: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/91.jpg)
SleepLet the device sleep
Battery life depends on sleep
iPhone 5S• Web browsing—about 8 to 10 hours
• Audio—about 40 hours
• Standby—about 250 hours
![Page 92: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/92.jpg)
![Page 93: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/93.jpg)
Voice Over IP
Bluetooth
Location
Networking
Notifications
![Page 94: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/94.jpg)
Device wakesHigh overhead cost
Overhead costDevice wakes
Time
Pow
er
![Page 95: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/95.jpg)
![Page 96: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/96.jpg)
![Page 97: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/97.jpg)
???
![Page 98: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/98.jpg)
Sleep/WakesBackground best practices
Notifications
VoIP
Location
Bluetooth
![Page 99: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/99.jpg)
Notifications
![Page 100: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/100.jpg)
NotificationsLocal/Push Notifications
![Page 101: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/101.jpg)
NotificationsLocal/Push Notifications
Device will wake for • Scheduled Local Notifications
• Receive remote Push Notifications
![Page 102: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/102.jpg)
NotificationsLocal/Push Notifications
Device will wake for • Scheduled Local Notifications
• Receive remote Push Notifications
Set Push Notification priority • 10—Delivered immediately
• 5—Delivered at power conservative time
![Page 103: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/103.jpg)
VoIP
![Page 104: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/104.jpg)
VoIP
Persistent connection • Periodic keep-alive packets
• Device wakes
• Code complexity
VoIP wakes
![Page 105: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/105.jpg)
VoIPPushKit framework
Leverages Apple Push Notification Service • No need to maintain persistent connection
VoIP Push Notifications • App Runtime to process the pushes
• App Relaunched if terminated
• Include up to 4k payload
![Page 106: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/106.jpg)
VoIPApplication adoption
#import <PushKit/PushKit.h>
!
- (void) voipRegistration {
PKPushRegistry * voipRegistry = [PKPushRegistry alloc] initWithQueue: dispatch_get_main_queue()];
voipRegistry.delegate = self;
voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP]; // register
}
![Page 107: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/107.jpg)
VoIPApplication adoption
#import <PushKit/PushKit.h>
!
- (void) voipRegistration {
PKPushRegistry * voipRegistry = [PKPushRegistry alloc] initWithQueue: dispatch_get_main_queue()];
voipRegistry.delegate = self;
voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP]; // register
}
![Page 108: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/108.jpg)
VoIPApplication adoption
#import <PushKit/PushKit.h>
!
- (void) voipRegistration {
PKPushRegistry * voipRegistry = [PKPushRegistry alloc] initWithQueue: dispatch_get_main_queue()];
voipRegistry.delegate = self;
voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP]; // register
}
![Page 109: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/109.jpg)
VoIPApplication adoption
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type {
// register voip push token with server
}
!
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
// received push
}
![Page 110: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/110.jpg)
VoIPApplication adoption
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type {
// register voip push token with server
}
!
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
// received push
}
![Page 111: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/111.jpg)
VoIPApplication adoption
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type {
// register voip push token with server
}
!
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
// received push
}
![Page 112: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/112.jpg)
VoIPServer side changes
Request VoIP Push Certificate
Send Push with VoIP Certificate • Receiving device requires iOS 8
![Page 113: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/113.jpg)
Location
![Page 114: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/114.jpg)
LocationContinuous location updates
![Page 115: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/115.jpg)
LocationContinuous location updates
[locationManager startUpdatingLocation]
!
Prevent device sleep
Accuracy makes a difference
![Page 116: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/116.jpg)
Energy Efficient LocationDeferred location updates
![Page 117: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/117.jpg)
Energy Efficient LocationDeferred location updates
[locationManager allowDeferredLocationUpdatesUntilTraveled: timeout:]
!
Available for GPS level accuracy
Data buffered on location hardware
Example • Run tracking app
![Page 118: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/118.jpg)
Energy Efficient LocationSignificant location change
![Page 119: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/119.jpg)
Energy Efficient LocationSignificant location change
[locationManager startMonitoringSignificantLocationChanges]
!
Location data with filters • Distance—Over 500 meters
• Time—Over 5 minutes
Example • Weather app
![Page 120: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/120.jpg)
Energy Efficient LocationRegion monitoring
![Page 121: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/121.jpg)
Energy Efficient LocationRegion monitoring
[locationManager startMonitoringForRegion:(CLRegion *)]
!
Application is notified on • Entrance into region
• Exit out of region
Example • Museum app
![Page 122: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/122.jpg)
Stop Location Updates
![Page 123: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/123.jpg)
LocationRun tracking app
Requirements • Keep track of the route
• Update coupons when close to stores
![Page 124: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/124.jpg)
LocationRun tracking app
Current solution • Continuous location updates
![Page 125: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/125.jpg)
LocationRun tracking app
Current solution • Continuous location updates
![Page 126: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/126.jpg)
LocationRun tracking app
Current solution • Continuous location updates
COUPON
![Page 127: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/127.jpg)
LocationRun tracking app
Energy efficient solution • Deferred location updates
• Region monitoring
![Page 128: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/128.jpg)
LocationRun tracking app
Energy efficient solution • Deferred location updates
• Region monitoring
![Page 129: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/129.jpg)
LocationRun tracking app
Energy efficient solution • Deferred location updates
• Region monitoring
![Page 130: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/130.jpg)
LocationRun tracking app
Energy efficient solution • Deferred location updates
• Region monitoring COUPON
![Page 131: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/131.jpg)
LocationEnergy efficient APIs
Deferred location updates
Significant location change
Region monitoring
iBeacons
AutoPause
Significant locations visited
![Page 132: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/132.jpg)
LocationEnergy efficient APIs
Deferred location updates
Significant location change
Region monitoring
iBeacons
AutoPause
Significant locations visited
![Page 133: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/133.jpg)
Bluetooth
![Page 134: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/134.jpg)
BluetoothInteracting with accessories
![Page 135: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/135.jpg)
Data transfer • Device wake for application
BluetoothInteracting with accessories
![Page 136: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/136.jpg)
Data transfer • Device wake for application
BluetoothInteracting with accessories
Overhead costDevice wakes
Time
Pow
er
![Page 137: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/137.jpg)
BluetoothRun tracking app
![Page 138: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/138.jpg)
BluetoothStreaming
![Page 139: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/139.jpg)
BluetoothStreaming
Fitness DataFitness DataFitness DataFitness DataFitness Data
![Page 140: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/140.jpg)
BluetoothBuffering
![Page 141: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/141.jpg)
BluetoothBuffering
Buffer Full!!!
![Page 142: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/142.jpg)
BluetoothBuffering
Buffer Full!!!
![Page 143: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/143.jpg)
BluetoothBuffering
![Page 144: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/144.jpg)
Run tracking appOne Step Further
![Page 145: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/145.jpg)
Run tracking appOne Step Further
![Page 146: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/146.jpg)
Run tracking appOne Step Further
![Page 147: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/147.jpg)
Run tracking appOne Step Further
Location data
![Page 148: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/148.jpg)
Run tracking appOne Step Further
Location data
Give me data
![Page 149: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/149.jpg)
Run tracking appOne Step Further
Location data
Give me data
![Page 150: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/150.jpg)
Run tracking appOne Step Further
![Page 151: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/151.jpg)
Coalesce workCut down wakes
![Page 152: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/152.jpg)
Final Thoughts
![Page 153: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/153.jpg)
“With great power comes great responsibility…”
![Page 154: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/154.jpg)
SummaryYour turn
![Page 155: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/155.jpg)
SummaryYour turn
Battery life impacts user experience
![Page 156: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/156.jpg)
SummaryYour turn
Battery life impacts user experience
Design your apps with the following in mind
![Page 157: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/157.jpg)
SummaryYour turn
Battery life impacts user experience
Design your apps with the following in mind
Do it never/less
![Page 158: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/158.jpg)
SummaryYour turn
Battery life impacts user experience
Design your apps with the following in mind
Do it never/less
Do it more efficiently
![Page 159: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/159.jpg)
SummaryYour turn
Battery life impacts user experience
Design your apps with the following in mind
Do it never/less
Do it more efficiently
Do it at a better time
![Page 160: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/160.jpg)
SummaryYour turn
Battery life impacts user experience
Design your apps with the following in mind
Do it never/less
Do it more efficiently
Do it at a better time
Be a considerate background app
![Page 161: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/161.jpg)
SummaryYour turn
Battery life impacts user experience
Design your apps with the following in mind
Do it never/less
Do it more efficiently
Do it at a better time
Be a considerate background app
Coalesce work
![Page 162: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/162.jpg)
SummaryYour turn
Battery life impacts user experience
Design your apps with the following in mind
Do it never/less
Do it more efficiently
Do it at a better time
Be a considerate background app
Coalesce work
Cutdown wakes
![Page 163: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/163.jpg)
More Information
Paul Danbold Core OS Technology Evangelist [email protected]
Jake Behrens Apps Frameworks Evangelist [email protected]
Apple Developer Forums http://devforums.apple.com
![Page 164: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/164.jpg)
Related Sessions
• Advanced Graphics and Animations for iOS Apps Russian Hill Tuesday 10:15AM
• What’s New in Core Location Marina Tuesday 2:00PM
• What’s New in Foundation Networking Nob Hill Tuesday 3:15PM
• Improving Your App with Instruments Marina Tuesday 4:30PM
• Writing Energy Efficient Code, Part I Russian Hill Wednesday 10:15AM
• Power, Performance and Diagnostics: What’s New in GCD and XPC
Russian Hill Thursday 2:00PM
![Page 165: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/165.jpg)
Labs
• Power and Performance Lab Core OS Lab B Wednesday 2:00PM
• Power and Performance Lab Core OS Lab A Thursday 3:15PM
• Notifications Lab Services Lab B Wednesday 3:15PM
• Instruments Lab Tools Lab B Thursday 9:00AM
• Core Location Lab Core OS Lab B Thursday 12:45PM
• Accessories and I/O Technologies Lab Core OS Lab A Thursday 12:45PM
![Page 166: Writing Energy Efficient Code - Apple Inc. · 2016-07-08 · Writing Energy Efficient Code Part 2 Session 712 Albert Liu iOS Software Power Engineer Core OS. Agenda ... • Web browsing—about](https://reader035.vdocument.in/reader035/viewer/2022062920/5f020c067e708231d4025004/html5/thumbnails/166.jpg)