SlideShare a Scribd company logo
1 of 19
Download to read offline
Google IO 2013
Web Performance Matters
Unispace 3D
Mitch
1
Google IO 2013 Sessions
Jank Free: Chrome Rendering Performance
True Grit: Debugging CSS & Render Performance
Web Page Design with the GPU in mind
Automating Performance Best Practices with PageSpeed
2
1. Focus on the user and all else will follow
2. It’s best to do one thing really, really well
3.Fast is better than slow
4. Democracy on the web works
5. You don’t need to be at your desk to need an answer
6. You can make money without doing evil
7. There’s always more information out there
8. The need for information crosses all borders
9. You can be serious without a suit
10.great just isn’t good enough
Google’s Ten Things
3
Freeing up the UI thread with
blisteringly-fast JS is key.
......but it’s not enough!
4
We need Fast Rendering!
5
Rendering Performance
Style recalculation
Layout (aka Reflow)
Paint
Composite
6
The Rendering Cycle
Build the DOM
Calculate CSS property values
Build the rendering tree
Calculate layout
Paint
Composite
7
The Rendering Cycle
Build the DOM
Calculate CSS property values
Build the rendering tree
Calculate layout
Paint
Composite
}Style Recalculation
}Layout
Painting
Compositing Layers
8
Rendering 101
Paint fast
Avoid accidental paints
Don’t paint at ALL
Eliminate layout
Minimize paint rectangles
Eliminate painting altogether
9
Visually complex CSS
Image decodes/resizes
Redundant large empty
layers
How to
position: fixed
overflow: scroll
hover effects
touch listeners
Unnecessary paints from:
Demo (hover effects)
Long paints from:
Demo (drag and drop)
10
How to
var newWidth = myDiv.offsetWidth+10; //Read
myDiv.style.width = newWidth+’px’; //Write
var newHeight = myDiv.offsetHeight+10; //Read
myDiv.style.height = newHeight+’px’; //Write
Unnecessary repaint & reflow:
11
How to
var newWidth = myDiv.offsetWidth+10; //Read
var newHeight = myDiv.offsetHeight+10; //Read
myDiv.style.width = newWidth+’px’; //Write
myDiv.style.height = newHeight+’px’; //Write
Better repaint & reflow:
12
How to
var div = document.getElementById(“box”);
lis = document.getElementByTagName(“li”);
i, len;
for(i=0; len=lis.length; i<len; i++) {
lis[i].style.width = div.offsetWidth+’px’;
}
Unnecessary repaint & reflow:
13
How to
var div = document.getElementById(“box”);
lis = document.getElementByTagName(“li”);
widthToSet = div.offsetWidth,
i, len;
for(i=0; len=lis.length; i<len; i++) {
lis[i].style.width = widthToSet+’px’;
}
Better repaint & reflow: Demo
14
Layers: Great for Animation
Want to animate with “no layout” and “no painting”
15
Layers
Painted independently, composited on the GPU
Can stretch, move, and fade without repainting
GPU + Layers = Faster Rendering
Too many layers = seriously bad time
Demo2Demo1
16
Hands-Free layer promotion
3D Transform
Canvas
Video
Plugins (i.e. Flash)
17
Use Dev Tools
Timeline
Show paint rectangles
Show composited layer borders
chrome://tracing
Continuous painting mode
PageSpeed (Chrome Extension)
18
Where to go from here
http://browserdiet.com/
http://coding.smashingmagazine.com/2012/11/05/
writing-fast-memory-efficient-javascript/
http://www.phpied.com/rendering-repaint-
reflowrelayout-restyle/
http://www.html5rocks.com/en/tutorials/speed/
layers/
http://updates.html5rocks.com/2013/02/Profiling-
19

More Related Content

Similar to Google IO 2013: Web Performance Matters

Mobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignMobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignCantina
 
Bootstrap Workout 2015
Bootstrap Workout 2015Bootstrap Workout 2015
Bootstrap Workout 2015Rob Davarnia
 
The future of BYU web design
The future of BYU web designThe future of BYU web design
The future of BYU web designNate Walton
 
Designing better user interfaces
Designing better user interfacesDesigning better user interfaces
Designing better user interfacesJohan Ronsse
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesVitaly Friedman
 
Progressive Enhancement
Progressive EnhancementProgressive Enhancement
Progressive EnhancementDan Sagisser
 
Accessible Javascript with and without WAI ARIA
Accessible Javascript with and without WAI ARIAAccessible Javascript with and without WAI ARIA
Accessible Javascript with and without WAI ARIADirk Ginader
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty grittyMario Noble
 
Building a game engine with jQuery
Building a game engine with jQueryBuilding a game engine with jQuery
Building a game engine with jQueryPaul Bakaus
 
2009_09_11_Grid960
2009_09_11_Grid9602009_09_11_Grid960
2009_09_11_Grid960LightSpeed
 
Responsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit HoleResponsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit HoleDan Moriarty
 
Fecc 12517-sd
Fecc 12517-sdFecc 12517-sd
Fecc 12517-sdThinkful
 
Advanced #2 - ui perf
 Advanced #2 - ui perf Advanced #2 - ui perf
Advanced #2 - ui perfVitali Pekelis
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applicationsVittorio Vittori
 
Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015Apoorv Saxena
 
Microsoft Webday 2008 - Silverlight Experiences
Microsoft Webday 2008 - Silverlight ExperiencesMicrosoft Webday 2008 - Silverlight Experiences
Microsoft Webday 2008 - Silverlight ExperiencesNicklas Andersson
 

Similar to Google IO 2013: Web Performance Matters (20)

Look ma! No images!
Look ma! No images!Look ma! No images!
Look ma! No images!
 
Mobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignMobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web Design
 
Bootstrap Workout 2015
Bootstrap Workout 2015Bootstrap Workout 2015
Bootstrap Workout 2015
 
The future of BYU web design
The future of BYU web designThe future of BYU web design
The future of BYU web design
 
Designing better user interfaces
Designing better user interfacesDesigning better user interfaces
Designing better user interfaces
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
Activity 5
Activity 5Activity 5
Activity 5
 
Progressive Enhancement
Progressive EnhancementProgressive Enhancement
Progressive Enhancement
 
Accessible Javascript with and without WAI ARIA
Accessible Javascript with and without WAI ARIAAccessible Javascript with and without WAI ARIA
Accessible Javascript with and without WAI ARIA
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
 
Building a game engine with jQuery
Building a game engine with jQueryBuilding a game engine with jQuery
Building a game engine with jQuery
 
2009_09_11_Grid960
2009_09_11_Grid9602009_09_11_Grid960
2009_09_11_Grid960
 
Responsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit HoleResponsive Design: Out of the Box and Down the Rabbit Hole
Responsive Design: Out of the Box and Down the Rabbit Hole
 
Fecc 12517-sd
Fecc 12517-sdFecc 12517-sd
Fecc 12517-sd
 
Designing with Code
Designing with CodeDesigning with Code
Designing with Code
 
Advanced #2 - ui perf
 Advanced #2 - ui perf Advanced #2 - ui perf
Advanced #2 - ui perf
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
 
Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015
 
Microsoft Webday 2008 - Silverlight Experiences
Microsoft Webday 2008 - Silverlight ExperiencesMicrosoft Webday 2008 - Silverlight Experiences
Microsoft Webday 2008 - Silverlight Experiences
 
Webdesign
WebdesignWebdesign
Webdesign
 

Recently uploaded

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Google IO 2013: Web Performance Matters

  • 1. Google IO 2013 Web Performance Matters Unispace 3D Mitch 1
  • 2. Google IO 2013 Sessions Jank Free: Chrome Rendering Performance True Grit: Debugging CSS & Render Performance Web Page Design with the GPU in mind Automating Performance Best Practices with PageSpeed 2
  • 3. 1. Focus on the user and all else will follow 2. It’s best to do one thing really, really well 3.Fast is better than slow 4. Democracy on the web works 5. You don’t need to be at your desk to need an answer 6. You can make money without doing evil 7. There’s always more information out there 8. The need for information crosses all borders 9. You can be serious without a suit 10.great just isn’t good enough Google’s Ten Things 3
  • 4. Freeing up the UI thread with blisteringly-fast JS is key. ......but it’s not enough! 4
  • 5. We need Fast Rendering! 5
  • 6. Rendering Performance Style recalculation Layout (aka Reflow) Paint Composite 6
  • 7. The Rendering Cycle Build the DOM Calculate CSS property values Build the rendering tree Calculate layout Paint Composite 7
  • 8. The Rendering Cycle Build the DOM Calculate CSS property values Build the rendering tree Calculate layout Paint Composite }Style Recalculation }Layout Painting Compositing Layers 8
  • 9. Rendering 101 Paint fast Avoid accidental paints Don’t paint at ALL Eliminate layout Minimize paint rectangles Eliminate painting altogether 9
  • 10. Visually complex CSS Image decodes/resizes Redundant large empty layers How to position: fixed overflow: scroll hover effects touch listeners Unnecessary paints from: Demo (hover effects) Long paints from: Demo (drag and drop) 10
  • 11. How to var newWidth = myDiv.offsetWidth+10; //Read myDiv.style.width = newWidth+’px’; //Write var newHeight = myDiv.offsetHeight+10; //Read myDiv.style.height = newHeight+’px’; //Write Unnecessary repaint & reflow: 11
  • 12. How to var newWidth = myDiv.offsetWidth+10; //Read var newHeight = myDiv.offsetHeight+10; //Read myDiv.style.width = newWidth+’px’; //Write myDiv.style.height = newHeight+’px’; //Write Better repaint & reflow: 12
  • 13. How to var div = document.getElementById(“box”); lis = document.getElementByTagName(“li”); i, len; for(i=0; len=lis.length; i<len; i++) { lis[i].style.width = div.offsetWidth+’px’; } Unnecessary repaint & reflow: 13
  • 14. How to var div = document.getElementById(“box”); lis = document.getElementByTagName(“li”); widthToSet = div.offsetWidth, i, len; for(i=0; len=lis.length; i<len; i++) { lis[i].style.width = widthToSet+’px’; } Better repaint & reflow: Demo 14
  • 15. Layers: Great for Animation Want to animate with “no layout” and “no painting” 15
  • 16. Layers Painted independently, composited on the GPU Can stretch, move, and fade without repainting GPU + Layers = Faster Rendering Too many layers = seriously bad time Demo2Demo1 16
  • 17. Hands-Free layer promotion 3D Transform Canvas Video Plugins (i.e. Flash) 17
  • 18. Use Dev Tools Timeline Show paint rectangles Show composited layer borders chrome://tracing Continuous painting mode PageSpeed (Chrome Extension) 18
  • 19. Where to go from here http://browserdiet.com/ http://coding.smashingmagazine.com/2012/11/05/ writing-fast-memory-efficient-javascript/ http://www.phpied.com/rendering-repaint- reflowrelayout-restyle/ http://www.html5rocks.com/en/tutorials/speed/ layers/ http://updates.html5rocks.com/2013/02/Profiling- 19