28
Chrome Dev Tools How to Improve Your Site’s Performance

Chrome Dev Tools

Embed Size (px)

DESCRIPTION

Google's Chrome browser has an amazing array of built in tools that allow us to both find problems in our websites and allow us to improve, all for free. This talk is for all front end developers working in JavaScript and/or CSS. I will show how to spot performance issues, find memory leaks and how to fix them both. And best of all I will present some easy to remember rules of thumb to prevent these issues from re-occurring.

Citation preview

Page 1: Chrome Dev Tools

Chrome Dev ToolsHow to Improve Your Site’s Performance

Page 2: Chrome Dev Tools

Android Wear Talk

• Smart watches are hot!

• Google is getting into the game

• Get ahead of the curve

• Free talk April 24th in LA

• http://bit.ly/1g6RMf6

Page 3: Chrome Dev Tools

Beginning Android Class

• Saturday, May 10th & 17th

• From installing the SDKs…

• to deploy to the Play Store

• Learn pro development tips and techniques

• http://bit.ly/1kqsqjP

Page 4: Chrome Dev Tools

Our Agenda

• The three pillars of page performance

• The Chrome Dev Tools

• Network tools

• Performance tools

• Rendering tools

Page 5: Chrome Dev Tools

The Three Pillars of Page Performance

• Network - Connection Speed + Latency

• Compute - JavaScript

• Render - Layout + Paint

Page 6: Chrome Dev Tools

Grade Your Site

• Google’s PageSpeed Insights

• https://developers.google.com/speed/pagespeed/insights

• Yahoo’s YSlow

• https://developer.yahoo.com/yslow/

Page 7: Chrome Dev Tools

PageSpeed Insights Demo

Page 8: Chrome Dev Tools

Chrome Dev Tools• Elements

• Network

• Sources

• Timeline

• Profiles

• Resources

• Audits

• Console

Page 9: Chrome Dev Tools

Chrome Dev Tools

• Elements

• Network

• Sources

• Timeline

Page 10: Chrome Dev Tools

Network Panel

• Shows how long it takes for your site to download

• latency - server processing time

• DOMContentLoaded - The whole document has been loaded

• load - The document and its resources are loaded

Page 11: Chrome Dev Tools

Images

• For most sites, images are the biggest resource and the easiest win

• Be sure to use the right image type

• Be sure to use the right image size

• Use sprite maps instead individual images

Page 12: Chrome Dev Tools

Image Types

• JPG - is for photos

• Can usually get good quality down to 75%

• PNG - is for images

• Be sure to pngcrush or other compression utility

Page 13: Chrome Dev Tools

Not Using Compression?

• In one case we scaled a 640x480 image down to 147x110

• This is 18 times more data than it should be

Page 14: Chrome Dev Tools

Yahoo! Smush It Demo

Page 15: Chrome Dev Tools

Performance Tools

Page 16: Chrome Dev Tools

Users don't care if an app is desktop or browser based, they want it to be buttery-smooth. Buttery-smooth is the opposite of janky. It is defined as 60 frames a second, or

16.6 ms per frame

Page 17: Chrome Dev Tools

Performance Tools

• The performance tools measure the amount of time it takes to render

• It can also tell you frames per second

• And even potential issues

Page 18: Chrome Dev Tools

Performance Tool Demo #1

Page 19: Chrome Dev Tools

Rendering Options

• Show paint rectangles

• Show composite layer borders

• Show FPS meter

• Enable continuous page repainting

• Show potential scroll bottlenecks

Page 20: Chrome Dev Tools

Show Paint Rectangles

• Shows the area of the screen being repainted

• Watch rectangles, the paint will union small rectangles together

Page 21: Chrome Dev Tools

Show composite layer borders

• Layering is a bit complicated

• Layering requires CSS3

• It uses CSS Transform

• Not 100% kosher

Page 22: Chrome Dev Tools

Show FPS meter

• Running clock of the FPS

• And your min and max frame rate

• Graph of your sites performance

Page 23: Chrome Dev Tools

Enable continuous page repainting

• Repaints continuously to show problems

• Best when used with Show Paint Rects.

Page 24: Chrome Dev Tools

Show potential scroll bottlenecks

• Scrolling is a place for your site to shine

• Turning this feature on shows:

• Events hook up to scroll

• Areas of the page which are repainted

Page 25: Chrome Dev Tools

Performance Demo #2

Page 26: Chrome Dev Tools

Resources

Page 27: Chrome Dev Tools

• Chrome Dev Toolshttps://developers.google.com/chrome-developer-tools/

• Yahoo! Smush Ithttp://www.smushit.com/ysmush.it/

• PageSpeed Insightshttp://developers.google.com/speed/pagespeed/insights/

Page 28: Chrome Dev Tools

• PNGCRUSH http://pmt.sourceforge.net/pngcrush/

• Making Layershttp://aerotwist.com/blog/on-translate3d-and-layer-creation-hacks/

• How Browsers Work http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/