Your WebPerf Sucks

If you like this presentation – show it...

Slide 0

Your WebPerf is ! Holger Bartel | @foobartel | HK CodeConf 23/10/2015

Slide 1

So, why?

Slide 2

Slide 3

42 requests, 6.3 MB

Slide 4

Slide 5

250 requests, 6.7 MB

Slide 6


Slide 7

Slide 8

86 requests, 10.2 MB

Slide 9

Performance is a thing.

Slide 10

Expectations Users expect ~2-3 seconds to load a site…

Slide 11

Expectations Users expect ~2-3 seconds to load a site… That’s the definition of ‘fast’ We’re even aiming to deliver something in even less

Slide 12

Expectations 50% of people say they'll abandon a page that takes longer than 4 seconds to load

Slide 13

Faster is Be er!

Slide 14

So, why?

Slide 15

The Real World (and why you should care)

Slide 16

40% of surveyed online shoppers will abandon a page that takes more than 3 seconds to load.
 — Akamai (2009)

Slide 17

Speeding up a fundraising site by 60% increased donations by 14%.
 — Kyle Rush, Obama Campaign (2012)

Slide 18

Adding half a second to a search results page can decrease traffic and ad revenues by 20 percent
 — Google

Slide 19

Every additional 100 milliseconds of load time decreased sales by 1 percent.
 — Amazon

Slide 20

Images - The Big Evil (and an easy fix)

Slide 21

Slide 22

Original 2 MB @ 298 x 530 ImageOptim App Optimised 73 KB

Slide 23

01 Oct 2012 - 15 Oct 2014 http://httparchive.org/interesting.php

Slide 24

01 Oct 2014 - 01 Oct 2015 http://httparchive.org/interesting.php

Slide 25

Performance is Design

Slide 26

Performance is Design Design is Performance

Slide 27

Performance is Design Design is Performance Design directs Performance

Slide 28

“Performance is a compromise between design and performance. You can only be as fast as the design allows.” — Ian Feather

Slide 29

Breaking Silos Collaboration & communication between designers and developers nowadays is essential and more important than ever before.

Slide 30

Get designs into the browser as soon as possible, so you, your team and your client can get a be er feel for what it will be like in the real world.

Slide 31

If your website is 15MB it’s not HTML5, it’s stupid. 
 — Christian Heilmann

Slide 32

Ask yourself: What's the gain? What do you want to achieve?

Slide 33

A carousel with 7 images is it really worth the load time or just pre y to look at?

Slide 34

Whereas it's questionable if images 3-7 will be seen in the first place.

Slide 35

Building for Performance

Slide 36

Rendering Pages

Slide 37

Render-Tree Construction, Layout & Paint Waiting for DOM and CSSOM to build the render tree. Render tree contains nodes to render the page. Layout computes the exact position and size. Paint turns the render tree into pixels on screen.

Slide 38

Render Blocking CSS Wait for CSS Avoids “Flash of Unstyled Content” (FOUC)

Slide 39

Render Blocking JavaScript The parser has to stop for scripts before continuing to parse HTML. JavaScript can query and modify DOM and CSSOM. JavaScript blocks DOM construction unless explicitly declared as async.

Slide 40

Loading Assets Every request fetched inside of HEAD, will postpone the rendering of the page

Slide 41

Limit HTTP Requests Every request takes roughly ~200ms Avoid unnecessary redirects

Slide 42

Critical Rendering Path Critical Resource Critical Path Length Critical Bytes

Slide 43

Optimising the Critical Rendering Path Optimising the dependency graph between HTML, CSS, and JavaScript.

Slide 44

Optimising the Critical Rendering Path = Ge ing ! on the screen fast

Slide 45

To get our li le friend ! on the screen fast…

Slide 46

Minimise the number of critical resources. Minimise the number of critical bytes. Minimise the critical path length. A critical resource is a resource that can block initial rendering of a page.

Slide 47

Analyse and characterise: number of resources, bytes, length. Minimise number of critical resources. Optimise order of remaining critical resources being loaded: download critical assets as early as possible. Optimise the number of critical bytes to reduce the download time (number of roundtrips).

Slide 48

Slide 49

Slide 50


Slide 51

Performance Testing http://www.webpagetest.org

Slide 52

Performance Testing http://tools.pingdom.com/fpt/ https://developers.google.com/speed/pagespeed/ https://developer.yahoo.com/yslow/

Slide 53

Chrome Dev Tools

Slide 54

Perf-Tooling Today http://perf-tooling.today

Slide 55

Perf Rocks http://perf.rocks

Slide 56

Perf School github.com/bevacqua/perfschool

Slide 57

With achieving fast page load time, people can quickly use your site and accomplish what they want.

Slide 58

People will appreciate it and end up being happier users.

Slide 59

Happier users mean be er conversion rates. Be er conversion rates can be increased revenue, more signups, returning visits, or downloads.

Slide 60

So… Let’s make the web less !

Slide 61

Thanks! Holger Bartel | @foobartel | HK CodeConf 23/10/2015

Slide 62