Slide 1

Slide 1 text

@towebperf Tweet! #towebperf ! ! DAVID NEWTON (@NEWTRON)
 RESPONSIVE IMAGES
 
 BLAKE CROSBY (@BLAKECROSBY)
 THE IMPORTANCE OF A CDN HELLO! & Review!

Slide 2

Slide 2 text

Improving Performance with Responsive Images Toronto Web Performance Group January 22, 2014

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

–Brad Frost “Good performance is good design”

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

–Anand Giridharadas, New York Times, April 10 2010 “More human beings today have access to a cellphone than the United Nations says have access to a clean toilet.”

Slide 9

Slide 9 text

–Anand Giridharadas, New York Times, April 10 2010 “More human beings today have access to a cellphone than the United Nations says have access to a clean toilet.”

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

1. A flexible, grid-based layout, 2. Flexible images and media, and 3. Media queries, a module from the CSS3 specification

Slide 13

Slide 13 text

1. A flexible, grid-based layout, 2. Flexible images and media, and 3. Media queries, a module from the CSS3 specification

Slide 14

Slide 14 text

img { max-width: 100%; }

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

A solution Serve one big image and let the browser scale it

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

• Average web page size: 1,681 KB • Images account for 1,031 KB, over 61% of total ! HTTP Archive, January 15 2014

Slide 21

Slide 21 text

2x resolution = 4x as many pixels

Slide 22

Slide 22 text

–Brad Frost “Good performance is good design”

Slide 23

Slide 23 text

A better solution Serve an appropriately-sized image to each user

Slide 24

Slide 24 text

Responsive Images

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

SVG, WebP, JPEG XR

Slide 30

Slide 30 text

• : http://picture.responsiveimages.org/ • srcset: http://www.w3.org/html/wg/drafts/srcset/ w3c-srcset/ • Client Hints: http://tools.ietf.org/html/draft-grigorik- http-client-hints-01

Slide 31

Slide 31 text

A rad wolf.

Slide 32

Slide 32 text

The president.

Slide 33

Slide 33 text

The president.

Slide 34

Slide 34 text

The president.

Slide 35

Slide 35 text

The president.

Slide 36

Slide 36 text

http://picture.responsiveimages.org/

Slide 37

Slide 37 text

Performance wins

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

Resource Priorities http://www.w3.org/TR/resource-priorities/

Slide 43

Slide 43 text

When can we expect this to work?

Slide 44

Slide 44 text

What can you do now?

Slide 45

Slide 45 text

ImageOptim-CLI http://jamiemason.github.io/ImageOptim-CLI/

Slide 46

Slide 46 text

Use fewer images

Slide 47

Slide 47 text

SVG

Slide 48

Slide 48 text

Picturefill https://github.com/scottjehl/picturefill

Slide 49

Slide 49 text

• Art direction • Viewport switching (using MQs) • DPR switching (using MQs)

Slide 50

Slide 50 text

A giant stone face

Slide 51

Slide 51 text

data-media="(min-device-pixel-ratio: 1.5), (min-resolution: 144dpi)"

Slide 52

Slide 52 text

• Art direction • Viewport switching (using MQs) • DPR switching (using MQs) • Resolution switching (using srcset) • File type switching • Resource priorities

Slide 53

Slide 53 text

• Art direction • Viewport switching (using MQs) • DPR switching (using MQs) • DPR switching (using srcset) • File type switching • Resource priorities

Slide 54

Slide 54 text

Picturefull https://github.com/nwtn/picturefill

Slide 55

Slide 55 text

... ... A giant stone face

Slide 56

Slide 56 text

Impact

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No optimizations • 11 HTTP requests • 2.9MB of data transferred • 3.72s load time

Slide 59

Slide 59 text

No optimizations • 11 HTTP requests • 2.9MB of data transferred • 3.72s load time

Slide 60

Slide 60 text

Optimizations • 14 HTTP requests • 476KB of data transferred (~84% savings) • 1.26s load time (~66% savings)

Slide 61

Slide 61 text

Optimizations • 14 HTTP requests • 476KB of data transferred (~84% savings) • 1.26s load time (~66% savings)

Slide 62

Slide 62 text

Optimizations + RP • 5 HTTP requests • 235KB of data transferred (~92% savings) • 1.11s load time (~70% savings)

Slide 63

Slide 63 text

Optimizations + RP • 5 HTTP requests • 235KB of data transferred (~92% savings) • 1.11s load time (~70% savings)

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

David Newton! @newtron on Twitter @nwtn on GitHub david@davidnewton.ca