際際滷

際際滷Share a Scribd company logo
3
Most read
5
Most read
7
Most read
Short Intro for Project Butter
Yoshi@8/5/2015
(Photo by Malcolm Dunbar/Picture Post/Getty Images)
Project Butter is?
 Butter, smoothness, for better UX
 Started at Android 4.1 (2012, API Level 16)
 Three main parts
 VSync
 Triple Buffering
 Touch Responsiveness (Choreographer)
Pseudocode of VSync-Style Program
No VSync Style VSync Style
VSync is  (In Android)
 A periodical interrupt
 To call your callback function
 Two possible implementations
1.Hardware timer
2.Software simulation
 A high priority thread which wakes up every 16.7ms
With and Without VSync
No VSync
With VSync
VSyncThread
Either HW or SW implementation
Triple Buffers?
 It doesnt mean to buffer something in many
contexts
 Not a verb, but a noun
 Its more like # of buffers it uses
 It can be proved that only 3 buffers are
required at most
 So you will never see 4+ buffer in game settings of
a game
Triple Buffer
Double buffer (A,B)
Triple Buffer (A,B,C)
Intro to Choreographer
 Choreographer (from Android Doc)
 Coordinates the timing of animations, input and
drawing
 The choreographer receives timing pulses (such as
vertical synchronization) from the display subsystem
 Schedules work to occur as part of rendering the next
display frame
Image:
http://jordanmleczko.weebly.com/my-future.html
Using Choreographer to Detect FPS
and Frame Dropping
https://github.com/yoshijava/Choreographer
Issue of Choreographer
Choreographer is designed to bind
with a specific looper (of an app)
But we need a system-wide frame-dropping and FPS notifier
Choreographer
VSyncThread (HW or SW)
VSync signals
looper
looper
looper
looper
Choreographer
Choreographer
Choreographer
Looper.myLooper();
Static method; Thread-Local Storage (TLS)
Choreographer has no public constructor, only static getInstance()
Static method; Thread-Local Storage (TLS)
Using Choreographer in any Activity
How about extending ChoreographerTest?
With callback, we can get # of
dropped frames and estimate
FPS manually
Summary
 Project Butter is not a new thing
 VSync and triple buffer are an old thing in desktop
 However, introduced to Android in 2012
 Choreographer is per app design
 Every app developer can optimize their apps by
getting notified when VSync signal comes
 Note that it is not system-wide (?)
Ad

Recommended

Communication in android
Communication in android
eleksdev
Zeroconf - Zero Configuration Networking
Zeroconf - Zero Configuration Networking
Murillo Grubler
[磯襭160409 覦覩手啓] UniRx 蠍
[磯襭160409 覦覩手啓] UniRx 蠍
MinGeun Park
Introduction to A-Frame
Introduction to A-Frame
Daosheng Mu
Servlets api overview
Servlets api overview
ramya marichamy
Android sensors
Android sensors
datta_jini
Hibernate
Hibernate
Ajay K
Hibernate ppt
Hibernate ppt
Aneega
Spring Security
Spring Security
Boy Tech
Google flutter and why does it matter
Google flutter and why does it matter
Ahmed Abu Eldahab
Android contentprovider
Android contentprovider
Krazy Koder
React JS
React JS
Software Infrastructure
Spring Mvc,Java, Spring
Spring Mvc,Java, Spring
ifnu bima
Applet Vs Servlet
Applet Vs Servlet
Bharat Sahu
Activity lifecycle
Activity lifecycle
Rehan Choudhary
Servlets
Servlets
Geethu Mohan
React & Redux JS
React & Redux JS
Hamed Farag
Android resources
Android resources
ma-polimi
Introduction to Spring Framework
Introduction to Spring Framework
Serhat Can
Exercicios de C#
Jorge Abdalla
Developing Apps With React Native
Developing Apps With React Native
Alvaro Viebrantz
Android Service Intro
Android Service Intro
Jintin Lin
React 多Qu辿 es React.js?
Gorka Maga単a
Node.js 亠仆亠 仍仂亢仆仂亳, 弍仂仍亠 仆舒亟亠亢仆仂亳 Holy.js 2021
Node.js 亠仆亠 仍仂亢仆仂亳, 弍仂仍亠 仆舒亟亠亢仆仂亳 Holy.js 2021
Timur Shemsedinov
Telephony API
Telephony API
Rashad Aliyev
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Scrum Breakfast Vietnam
Reactjs
Reactjs
Neha Sharma
Building Data Pipelines for Solr with Apache NiFi
Building Data Pipelines for Solr with Apache NiFi
Bryan Bende
The Road to 60 FPS
The Road to 60 FPS
Jason Sendros
Asynchronous Programming in Android
Asynchronous Programming in Android
John Pendexter

More Related Content

What's hot (20)

Spring Security
Spring Security
Boy Tech
Google flutter and why does it matter
Google flutter and why does it matter
Ahmed Abu Eldahab
Android contentprovider
Android contentprovider
Krazy Koder
React JS
React JS
Software Infrastructure
Spring Mvc,Java, Spring
Spring Mvc,Java, Spring
ifnu bima
Applet Vs Servlet
Applet Vs Servlet
Bharat Sahu
Activity lifecycle
Activity lifecycle
Rehan Choudhary
Servlets
Servlets
Geethu Mohan
React & Redux JS
React & Redux JS
Hamed Farag
Android resources
Android resources
ma-polimi
Introduction to Spring Framework
Introduction to Spring Framework
Serhat Can
Exercicios de C#
Jorge Abdalla
Developing Apps With React Native
Developing Apps With React Native
Alvaro Viebrantz
Android Service Intro
Android Service Intro
Jintin Lin
React 多Qu辿 es React.js?
Gorka Maga単a
Node.js 亠仆亠 仍仂亢仆仂亳, 弍仂仍亠 仆舒亟亠亢仆仂亳 Holy.js 2021
Node.js 亠仆亠 仍仂亢仆仂亳, 弍仂仍亠 仆舒亟亠亢仆仂亳 Holy.js 2021
Timur Shemsedinov
Telephony API
Telephony API
Rashad Aliyev
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Scrum Breakfast Vietnam
Reactjs
Reactjs
Neha Sharma
Building Data Pipelines for Solr with Apache NiFi
Building Data Pipelines for Solr with Apache NiFi
Bryan Bende
Spring Security
Spring Security
Boy Tech
Google flutter and why does it matter
Google flutter and why does it matter
Ahmed Abu Eldahab
Android contentprovider
Android contentprovider
Krazy Koder
Spring Mvc,Java, Spring
Spring Mvc,Java, Spring
ifnu bima
Applet Vs Servlet
Applet Vs Servlet
Bharat Sahu
React & Redux JS
React & Redux JS
Hamed Farag
Android resources
Android resources
ma-polimi
Introduction to Spring Framework
Introduction to Spring Framework
Serhat Can
Exercicios de C#
Jorge Abdalla
Developing Apps With React Native
Developing Apps With React Native
Alvaro Viebrantz
Android Service Intro
Android Service Intro
Jintin Lin
React 多Qu辿 es React.js?
Gorka Maga単a
Node.js 亠仆亠 仍仂亢仆仂亳, 弍仂仍亠 仆舒亟亠亢仆仂亳 Holy.js 2021
Node.js 亠仆亠 仍仂亢仆仂亳, 弍仂仍亠 仆舒亟亠亢仆仂亳 Holy.js 2021
Timur Shemsedinov
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Scrum Breakfast Vietnam
Building Data Pipelines for Solr with Apache NiFi
Building Data Pipelines for Solr with Apache NiFi
Bryan Bende

Similar to Short intro to project butter (8)

The Road to 60 FPS
The Road to 60 FPS
Jason Sendros
Asynchronous Programming in Android
Asynchronous Programming in Android
John Pendexter
Android - Graphics Animation in Android
Android - Graphics Animation in Android
Vibrant Technologies & Computers
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
Efficient Android Threading
Efficient Android Threading
Anders G旦ransson
Android App Development - 07 Threading
Android App Development - 07 Threading
Diego Grancini
Tools and Techniques for Understanding Threading Behavior in Android
Tools and Techniques for Understanding Threading Behavior in Android
Intel速 Software
Android Best Practices - Thoughts from the Trenches
Android Best Practices - Thoughts from the Trenches
Anuradha Weeraman
The Road to 60 FPS
The Road to 60 FPS
Jason Sendros
Asynchronous Programming in Android
Asynchronous Programming in Android
John Pendexter
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
Efficient Android Threading
Efficient Android Threading
Anders G旦ransson
Android App Development - 07 Threading
Android App Development - 07 Threading
Diego Grancini
Tools and Techniques for Understanding Threading Behavior in Android
Tools and Techniques for Understanding Threading Behavior in Android
Intel速 Software
Android Best Practices - Thoughts from the Trenches
Android Best Practices - Thoughts from the Trenches
Anuradha Weeraman
Ad

More from Yoshi Shih-Chieh Huang (7)

Architectural modeling
Architectural modeling
Yoshi Shih-Chieh Huang
Flash knowledge
Flash knowledge
Yoshi Shih-Chieh Huang
Usage and Comparisons of Control Group in Android AOSP: Marshmallow and Before
Usage and Comparisons of Control Group in Android AOSP: Marshmallow and Before
Yoshi Shih-Chieh Huang
Attackboard slides dac12-0605
Attackboard slides dac12-0605
Yoshi Shih-Chieh Huang
On the End-to-End Traffic Prediction in the On-Chip Networks
On the End-to-End Traffic Prediction in the On-Chip Networks
Yoshi Shih-Chieh Huang
Logical Time
Logical Time
Yoshi Shih-Chieh Huang
Introduction to amazon web service (clean)
Introduction to amazon web service (clean)
Yoshi Shih-Chieh Huang
Usage and Comparisons of Control Group in Android AOSP: Marshmallow and Before
Usage and Comparisons of Control Group in Android AOSP: Marshmallow and Before
Yoshi Shih-Chieh Huang
On the End-to-End Traffic Prediction in the On-Chip Networks
On the End-to-End Traffic Prediction in the On-Chip Networks
Yoshi Shih-Chieh Huang
Introduction to amazon web service (clean)
Introduction to amazon web service (clean)
Yoshi Shih-Chieh Huang
Ad

Recently uploaded (20)

AI for PV: Development and Governance for a Regulated Industry
AI for PV: Development and Governance for a Regulated Industry
Biologit
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
Top Time Tracking Solutions for Accountants
Top Time Tracking Solutions for Accountants
oliviareed320
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
University Campus Navigation for All - Peak of Data & AI
University Campus Navigation for All - Peak of Data & AI
Safe Software
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
Microsoft-365-Administrator-s-Guide1.pdf
Microsoft-365-Administrator-s-Guide1.pdf
mazharatknl
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
Test Case Design Techniques Practical Examples & Best Practices in Software...
Test Case Design Techniques Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Philip Schwarz
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
AI for PV: Development and Governance for a Regulated Industry
AI for PV: Development and Governance for a Regulated Industry
Biologit
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
Top Time Tracking Solutions for Accountants
Top Time Tracking Solutions for Accountants
oliviareed320
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
University Campus Navigation for All - Peak of Data & AI
University Campus Navigation for All - Peak of Data & AI
Safe Software
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
Microsoft-365-Administrator-s-Guide1.pdf
Microsoft-365-Administrator-s-Guide1.pdf
mazharatknl
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
Test Case Design Techniques Practical Examples & Best Practices in Software...
Test Case Design Techniques Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Philip Schwarz
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME

Short intro to project butter

  • 1. Short Intro for Project Butter Yoshi@8/5/2015 (Photo by Malcolm Dunbar/Picture Post/Getty Images)
  • 2. Project Butter is? Butter, smoothness, for better UX Started at Android 4.1 (2012, API Level 16) Three main parts VSync Triple Buffering Touch Responsiveness (Choreographer)
  • 3. Pseudocode of VSync-Style Program No VSync Style VSync Style
  • 4. VSync is (In Android) A periodical interrupt To call your callback function Two possible implementations 1.Hardware timer 2.Software simulation A high priority thread which wakes up every 16.7ms
  • 5. With and Without VSync No VSync With VSync
  • 6. VSyncThread Either HW or SW implementation
  • 7. Triple Buffers? It doesnt mean to buffer something in many contexts Not a verb, but a noun Its more like # of buffers it uses It can be proved that only 3 buffers are required at most So you will never see 4+ buffer in game settings of a game
  • 8. Triple Buffer Double buffer (A,B) Triple Buffer (A,B,C)
  • 9. Intro to Choreographer Choreographer (from Android Doc) Coordinates the timing of animations, input and drawing The choreographer receives timing pulses (such as vertical synchronization) from the display subsystem Schedules work to occur as part of rendering the next display frame Image: http://jordanmleczko.weebly.com/my-future.html
  • 10. Using Choreographer to Detect FPS and Frame Dropping https://github.com/yoshijava/Choreographer
  • 11. Issue of Choreographer Choreographer is designed to bind with a specific looper (of an app) But we need a system-wide frame-dropping and FPS notifier
  • 12. Choreographer VSyncThread (HW or SW) VSync signals looper looper looper looper Choreographer Choreographer Choreographer
  • 13. Looper.myLooper(); Static method; Thread-Local Storage (TLS) Choreographer has no public constructor, only static getInstance() Static method; Thread-Local Storage (TLS)
  • 14. Using Choreographer in any Activity How about extending ChoreographerTest?
  • 15. With callback, we can get # of dropped frames and estimate FPS manually
  • 16. Summary Project Butter is not a new thing VSync and triple buffer are an old thing in desktop However, introduced to Android in 2012 Choreographer is per app design Every app developer can optimize their apps by getting notified when VSync signal comes Note that it is not system-wide (?)