SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
iOS Scroll
Performance
Kyle Sherman
LinkedIn iOS Developer
Don’t just blame a
technology
(i.e. Autolayout)
Measure!
Step 1: Use Instruments
to measure Scroll
Performance
Rule #1: Always
profile on device!
Setting Up Instruments
• Hit Command-I to Profile
• Or Product -> Profile
• Or Hold down Play button;
select Profile
• After done building (long
time), select Core Animation
• Turn on Device Utilization %
Setting Up Instruments
• Hit Command-I to Profile
• Or Product -> Profile
• Or Hold down Play button;
select Profile
• After done building (long
time), select Core Animation
• Turn on Device Utilization %
Setting Up Instruments
• Hit Command-I to Profile
• Or Product -> Profile
• Or Hold down Play button;
select Profile
• After done building (long
time), select Core Animation
• Turn on Device Utilization %
Profiling
• Tip #1: Decrease sample rate
• Hit the Record Button
• Tip #2: Set flags using
Command-Down arrow
• Tip #3: Double click flag to
name it
Profiling
• Tip #1: Decrease sample rate
• Hit the Record Button
• Tip #2: Set flags using
Command-Down arrow
• Tip #3: Double click flag to
name it
Profiling
• Tip #1: Decrease sample rate
• Hit the Record Button
• Tip #2: Set flags using
Command-Down arrow
• Tip #3: Double click flag to
name it
Profiling
• Tip #1: Decrease sample rate
• Hit the Record Button
• Tip #2: Set flags using
Command-Down arrow
• Tip #3: Single click flag to
name it
Step 2: Analyze
results
Examine Frame Rate
• Examine the frame rate
• Look at the CPU and GPU
usage at and around large
frame rate drops
Examine Frame Rate
• If Render/Device utilization is
high, requires more
investigation (details later)
• If not, and CPU usage is high:
• Click Time Profiler so CPU
usage is highlighted
• Drag around peak
• Look at heaviest stack trace
Step 3: Fix the
problem
GPU Issues
• GPU Issues require further
diagnosis
• Easiest way is to use Simulator
• Offscreen-Rendered is worst
performance hit (details to
come)
• Watch WWDC 2014 Session
419: Advanced Graphics and
Animations for iOS Apps
Step 4: Measure
Again!
Step 5: Repeat Steps
2, 3, & 4 until satisfied
Which brings us to our
concrete example…
Performant Circular
Images
Concrete Example:
Applying the skills learned
from the previous part, we
diagnose the issue(s)
Problem
Extremely Choppy Scrolling
in this view
Analyzing The Data
• Both the GPU utilization was high and CPU was
spiking
• I decided to investigate CPU usage first,
because it was possibly simpler to understand
• Saw suspicious methods and fixed issues in
code
Results
Frame rate increased very slightly
Re-measure!
GPU Issues
• Now it was time to resolve the GPU issues
• After watching WWDC 2014 Session 419,
learned about rendering pipeline and how bad
offscreen rendering is
• The following is a screenshot with Color
Offscreen-Rendered turned on
Color Offscreen-Rendered
On
Analysis
• Every single circle is
offscreen-rendered
• There are tons of circles on
the screen
• Need a more performant way
to make the circle
Test Hypothesis
Turn off circle creation
Yep!
After remeasuring, scrolling
is now smooth.
And look at Offscreen-
Rendered now!
Solutions
Solution #1
• In the WWDC session, Apple
suggests creating a mask like
the figure to the left of the
canvas
• Create the mask by drawing a
circle inside of a square of the
same size of the image
• Only fill outside of the circle
• The fill color of the mask must
be the same as the view (white
in this case)
• Place this mask on top of the
image (as a subview)
Image
Doesn’t work in this
case
Reason: Circles overlap
Solution #2
Retrieve circular images from API
Valid solution, but…
Adds to the number of images we serve (storage $$)
Solution #3
• Create a circular image mask and apply to the
image
• Perform on a background thread, so it doesn’t
block UI thread
Solution #3 (code)
https://gist.github.com/drumnkyle/c2ae34ea2422514c45d5
Solution #3 Tips
• Only do it once per image if possible
• You can process when image downloads or first
time it is used
• Add a circular version of the image to your
cache
Resources
• I highly recommend watching the WWDC video
mentioned. Maybe even a few times as it goes
into very good detail.
• Apple TV tech talks video Tuning your tvOS
Apps, also goes over these topics
https://developer.apple.com/videos/play/wwdc2014-419/
https://developer.apple.com/videos/play/techtalks-apple-tv/9/

Weitere ähnliche Inhalte

Was ist angesagt?

2014 Career & Workplace Trend: How To Stay Competitive
2014 Career & Workplace Trend: How To Stay Competitive2014 Career & Workplace Trend: How To Stay Competitive
2014 Career & Workplace Trend: How To Stay Competitive
GetSmarter
 

Was ist angesagt? (20)

No excuses user research
No excuses user researchNo excuses user research
No excuses user research
 
2014 Career & Workplace Trend: How To Stay Competitive
2014 Career & Workplace Trend: How To Stay Competitive2014 Career & Workplace Trend: How To Stay Competitive
2014 Career & Workplace Trend: How To Stay Competitive
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreakPwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreak
 
10 Ridiculous Hacks to 5X Click-Through Rates
10 Ridiculous Hacks to 5X Click-Through Rates 10 Ridiculous Hacks to 5X Click-Through Rates
10 Ridiculous Hacks to 5X Click-Through Rates
 
Clover Rings Up Digital Growth to Drive Experimentation
Clover Rings Up Digital Growth to Drive ExperimentationClover Rings Up Digital Growth to Drive Experimentation
Clover Rings Up Digital Growth to Drive Experimentation
 
Insights2020: Driving Customer-Centric Business Growth
Insights2020: Driving Customer-Centric Business Growth Insights2020: Driving Customer-Centric Business Growth
Insights2020: Driving Customer-Centric Business Growth
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
 
Look EAST - A behavioural insights model for improved customer experience
Look EAST - A behavioural insights model for improved customer experienceLook EAST - A behavioural insights model for improved customer experience
Look EAST - A behavioural insights model for improved customer experience
 
Designing Teams for Emerging Challenges
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging Challenges
 
Smadex DSP MOBILE
Smadex DSP MOBILESmadex DSP MOBILE
Smadex DSP MOBILE
 
Dark Web and Threat Intelligence
Dark Web and Threat IntelligenceDark Web and Threat Intelligence
Dark Web and Threat Intelligence
 
Leveraging Spark ML for Real-Time Credit Card Approvals with Anand Venugopal ...
Leveraging Spark ML for Real-Time Credit Card Approvals with Anand Venugopal ...Leveraging Spark ML for Real-Time Credit Card Approvals with Anand Venugopal ...
Leveraging Spark ML for Real-Time Credit Card Approvals with Anand Venugopal ...
 
Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark Applications
 
Zara business model (mehdi karimi)
Zara business model (mehdi karimi)Zara business model (mehdi karimi)
Zara business model (mehdi karimi)
 
Optimizing Hive Queries
Optimizing Hive QueriesOptimizing Hive Queries
Optimizing Hive Queries
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
DevOps for Databricks
DevOps for DatabricksDevOps for Databricks
DevOps for Databricks
 
Sephora Customer Presentation
Sephora Customer PresentationSephora Customer Presentation
Sephora Customer Presentation
 
How LinkedIn built a Community of Half a Billion
How LinkedIn built a Community of Half a BillionHow LinkedIn built a Community of Half a Billion
How LinkedIn built a Community of Half a Billion
 
Clickbait: A Guide To Writing Un-Ignorable Headlines
Clickbait: A Guide To Writing Un-Ignorable HeadlinesClickbait: A Guide To Writing Un-Ignorable Headlines
Clickbait: A Guide To Writing Un-Ignorable Headlines
 

Andere mochten auch

Nobel Peace Prize 2014: Malala Yousafzai and Kailash Satyarthi
Nobel Peace Prize 2014: Malala Yousafzai and Kailash SatyarthiNobel Peace Prize 2014: Malala Yousafzai and Kailash Satyarthi
Nobel Peace Prize 2014: Malala Yousafzai and Kailash Satyarthi
maditabalnco
 

Andere mochten auch (20)

提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?
 
Skills To Make You An Effective Manager
Skills To Make You An Effective ManagerSkills To Make You An Effective Manager
Skills To Make You An Effective Manager
 
KKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - HokilaKKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - Hokila
 
困境與轉型:一個小型開發團隊的 DevOps 學習之旅
困境與轉型:一個小型開發團隊的 DevOps 學習之旅困境與轉型:一個小型開發團隊的 DevOps 學習之旅
困境與轉型:一個小型開發團隊的 DevOps 學習之旅
 
Bubble gum
Bubble gumBubble gum
Bubble gum
 
The Journey
The JourneyThe Journey
The Journey
 
The Deep Web - How the Deep Web Works
The Deep Web - How the Deep Web WorksThe Deep Web - How the Deep Web Works
The Deep Web - How the Deep Web Works
 
Deep Web
Deep WebDeep Web
Deep Web
 
Deep Web - what to do and what not to do
Deep Web - what to do and what not to do	Deep Web - what to do and what not to do
Deep Web - what to do and what not to do
 
Presentation on Medicated Chewing Gums
Presentation on Medicated Chewing GumsPresentation on Medicated Chewing Gums
Presentation on Medicated Chewing Gums
 
Dos and Don'ts of an Engineering Statement of Purpose
Dos and Don'ts of an Engineering Statement of PurposeDos and Don'ts of an Engineering Statement of Purpose
Dos and Don'ts of an Engineering Statement of Purpose
 
Deep web
Deep webDeep web
Deep web
 
Human Body
Human BodyHuman Body
Human Body
 
Nobel Peace Prize 2014: Malala Yousafzai and Kailash Satyarthi
Nobel Peace Prize 2014: Malala Yousafzai and Kailash SatyarthiNobel Peace Prize 2014: Malala Yousafzai and Kailash Satyarthi
Nobel Peace Prize 2014: Malala Yousafzai and Kailash Satyarthi
 
Impossible Is Nothing
Impossible Is NothingImpossible Is Nothing
Impossible Is Nothing
 
Nobel prize
Nobel prizeNobel prize
Nobel prize
 
10 facts about japan
10 facts about japan10 facts about japan
10 facts about japan
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functions
 
Impossible is Nothing?
Impossible is Nothing?Impossible is Nothing?
Impossible is Nothing?
 
Japan - An Emerging Civilization
Japan - An Emerging CivilizationJapan - An Emerging Civilization
Japan - An Emerging Civilization
 

Ähnlich wie iOS Scroll Performance

Evaluation Q6)
Evaluation Q6)Evaluation Q6)
Evaluation Q6)
Yaquob1
 
Help your tech
Help your tech Help your tech
Help your tech
stantons
 

Ähnlich wie iOS Scroll Performance (20)

Ml goes fruitful
Ml goes fruitfulMl goes fruitful
Ml goes fruitful
 
Evaluation Q6)
Evaluation Q6)Evaluation Q6)
Evaluation Q6)
 
USPTA Norcal Video Analysis on a Budget
USPTA Norcal Video Analysis on a BudgetUSPTA Norcal Video Analysis on a Budget
USPTA Norcal Video Analysis on a Budget
 
iPads in the Early Years Classroom
iPads in the Early Years ClassroomiPads in the Early Years Classroom
iPads in the Early Years Classroom
 
Introductory Augmented Reality in Unity with Android and Vuforia
Introductory Augmented Reality in Unity with Android and VuforiaIntroductory Augmented Reality in Unity with Android and Vuforia
Introductory Augmented Reality in Unity with Android and Vuforia
 
Evaluation – Question 5
Evaluation – Question 5Evaluation – Question 5
Evaluation – Question 5
 
What have you learnt about technologies from the
What have you learnt about technologies from theWhat have you learnt about technologies from the
What have you learnt about technologies from the
 
Question 6
Question 6Question 6
Question 6
 
An Introduction To Software Development - Final Review
An Introduction To Software Development - Final ReviewAn Introduction To Software Development - Final Review
An Introduction To Software Development - Final Review
 
Simulating systems: Delivering digital difference
Simulating systems: Delivering digital differenceSimulating systems: Delivering digital difference
Simulating systems: Delivering digital difference
 
Machine learning pipeline
Machine learning pipelineMachine learning pipeline
Machine learning pipeline
 
Help your tech
Help your tech Help your tech
Help your tech
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
Real time emotion recognition during presentations - Artemii Frolov
Real time emotion recognition during presentations - Artemii FrolovReal time emotion recognition during presentations - Artemii Frolov
Real time emotion recognition during presentations - Artemii Frolov
 
Basic Machinima Making, Part 3
Basic Machinima Making, Part 3Basic Machinima Making, Part 3
Basic Machinima Making, Part 3
 
DMC NI Week 2014 High Speed Vision
DMC NI Week 2014 High Speed VisionDMC NI Week 2014 High Speed Vision
DMC NI Week 2014 High Speed Vision
 
Question 6 evaluation
Question 6 evaluationQuestion 6 evaluation
Question 6 evaluation
 
Module05 arena
Module05 arenaModule05 arena
Module05 arena
 
Question 6
Question 6Question 6
Question 6
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

iOS Scroll Performance