8
Page Speed Bryan McQuade Richard Rabbat

Page Speed Bryan McQuade Richard Rabbat. Outline What is Page Speed? Inception of Page Speed Cool features Identify unused JavaScript and CSS

Embed Size (px)

Citation preview

Page 1: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

Page SpeedBryan McQuadeRichard Rabbat

Page 2: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

Outline

What is Page Speed?

Inception of Page Speed

Cool features

Identify unused JavaScript and CSS

Pointing out inefficient CSS selectors

The activity panel

Demo

Page 3: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

What is Page Speed

Firefox/Firebug add-on

Inspired by Yahoo’s YSlow

Open source, open repository @ code.google.com/p/page-speed

Optimizations done by the add-on when possible

Optimized images

Minified JavaScript

Page Speed tells you what JavaScript you should defer

Nice stats: 100k downloads in 10 days, 1000’s of tweets , 100’s of blog posts

Page 4: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

Inception of Page Speed

Google teams developed their own optimizations independently

Best practices being relearned by new apps as we developed them

Scouring the Internet gave us great ideas

Implemented to make sure that as we developed our pages, we didn’t add regressions

Spent a lot of time carefully testing, crafting implementation

Proxies, browsers

Page 5: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

Identifying unused JavaScript

x% of a site’s JavaScript loaded by a page that had not been invoked by the time the OnLoad handler completed

Why it’s good to fix

Scripts downloaded, parsed and executed before rendering a web page

When JavaScript is being processed, browser blocks all other resources from being downloaded

Complex web apps have sizeable latency impact when JavaScript not properly modularized

Page 6: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

Pointing out Inefficient Selectors

Universal selectors are inefficient

Rules with descendant selectors such as

body * {...}

Rules with child or adjacent selectors such as

body > * {...}

Best to

avoid universal key selector

Make rules specific when possible

Get rid of redundant qualifiers, and others…

Refer to Hyatt’s excellent documentation “Writing efficient CSS…”

Page 7: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

The Activity Panel

Records a timeline of network and local events

DNS, connection wait, connect, request wait, connected

Cache hit, data available, JavaScript parse and JavaScript execute

Coming soon

Paint events

Screen snapshots over time

Developers can do before/after analysis to see how their changes affect the activity stream

Page 8: Page Speed Bryan McQuade Richard Rabbat. Outline  What is Page Speed?  Inception of Page Speed  Cool features  Identify unused JavaScript and CSS

Activity Panel Screenshots Shows where time is

spent during page load.

Page load serialized on JavaScript download, parse, execution.

DNS lookups for JS add significant latency.

news.bbc.co.uk

gmail.com