hk codeconf 2015 - your webperf sucks

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

Upload: holger-bartel

Post on 15-Apr-2017

8.011 views

Category:

Software


0 download

TRANSCRIPT

Page 1: HK CodeConf 2015 - Your WebPerf Sucks

Your WebPerf is !

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

Page 2: HK CodeConf 2015 - Your WebPerf Sucks

So, why?

Page 3: HK CodeConf 2015 - Your WebPerf Sucks
Page 4: HK CodeConf 2015 - Your WebPerf Sucks

42 requests, 6.3 MB

Page 5: HK CodeConf 2015 - Your WebPerf Sucks
Page 6: HK CodeConf 2015 - Your WebPerf Sucks

250 requests, 6.7 MB

Page 7: HK CodeConf 2015 - Your WebPerf Sucks

"

Page 8: HK CodeConf 2015 - Your WebPerf Sucks
Page 9: HK CodeConf 2015 - Your WebPerf Sucks

86 requests, 10.2 MB

Page 10: HK CodeConf 2015 - Your WebPerf Sucks

Performance is a thing.

Page 11: HK CodeConf 2015 - Your WebPerf Sucks

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

Expectations

Page 12: HK CodeConf 2015 - Your WebPerf Sucks

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

Expectations

Page 13: HK CodeConf 2015 - Your WebPerf Sucks

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

Expectations

Page 14: HK CodeConf 2015 - Your WebPerf Sucks

Faster is Be!er!

Page 15: HK CodeConf 2015 - Your WebPerf Sucks

So, why?

Page 16: HK CodeConf 2015 - Your WebPerf Sucks

The Real World (and why you should care)

Page 17: HK CodeConf 2015 - Your WebPerf Sucks

40% of surveyed online shoppers will abandon a page that takes more than 3

seconds to load.— Akamai (2009)

Page 18: HK CodeConf 2015 - Your WebPerf Sucks

Speeding up a fundraising site by 60% increased donations by 14%.

— Kyle Rush, Obama Campaign (2012)

Page 19: HK CodeConf 2015 - Your WebPerf Sucks

Adding half a second to a search results page can decrease traffic and ad

revenues by 20 percent — Google

Page 20: HK CodeConf 2015 - Your WebPerf Sucks

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

— Amazon

Page 21: HK CodeConf 2015 - Your WebPerf Sucks

Images - The Big Evil(and an easy fix)

Page 22: HK CodeConf 2015 - Your WebPerf Sucks
Page 23: HK CodeConf 2015 - Your WebPerf Sucks

Original Optimised

2 MB @ 298 x 530

73 KB

ImageOptim App

Page 24: HK CodeConf 2015 - Your WebPerf Sucks

01 Oct 2012 - 15 Oct 2014

http://httparchive.org/interesting.php

Page 25: HK CodeConf 2015 - Your WebPerf Sucks

http://httparchive.org/interesting.php

01 Oct 2014 - 01 Oct 2015

Page 26: HK CodeConf 2015 - Your WebPerf Sucks

Performance is Design

Page 27: HK CodeConf 2015 - Your WebPerf Sucks

Performance is Design

Design is Performance

Page 28: HK CodeConf 2015 - Your WebPerf Sucks

Performance is Design

Design is Performance

Design directs Performance

Page 29: HK CodeConf 2015 - Your WebPerf Sucks

— Ian Feather

“Performance is a compromise between design and performance.

You can only be as fast as the design allows.”

Page 30: HK CodeConf 2015 - Your WebPerf Sucks

Collaboration & communication between designers and developers nowadays is essential and more

important than ever before.

Breaking Silos

Page 31: HK CodeConf 2015 - Your WebPerf Sucks

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.

Page 32: HK CodeConf 2015 - Your WebPerf Sucks

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

— Christian Heilmann

Page 33: HK CodeConf 2015 - Your WebPerf Sucks

Ask yourself:

What's the gain?

What do you want to achieve?

Page 34: HK CodeConf 2015 - Your WebPerf Sucks

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

at?

Page 35: HK CodeConf 2015 - Your WebPerf Sucks

Whereas it's questionable if images 3-7 will be seen

in the first place.

Page 36: HK CodeConf 2015 - Your WebPerf Sucks

Building for Performance

Page 37: HK CodeConf 2015 - Your WebPerf Sucks

Rendering Pages

Page 38: HK CodeConf 2015 - Your WebPerf Sucks

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.

Render-Tree Construction, Layout & Paint

Page 39: HK CodeConf 2015 - Your WebPerf Sucks

Wait for CSS

Avoids “Flash of Unstyled Content” (FOUC)

Render Blocking CSS

Page 40: HK CodeConf 2015 - Your WebPerf Sucks

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.

Render Blocking JavaScript

Page 41: HK CodeConf 2015 - Your WebPerf Sucks

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

Loading Assets

Page 42: HK CodeConf 2015 - Your WebPerf Sucks

Every request takes roughly ~200ms

Avoid unnecessary redirects

Limit HTTP Requests

Page 43: HK CodeConf 2015 - Your WebPerf Sucks

Critical Resource

Critical Path Length

Critical Bytes

Critical Rendering Path

Page 44: HK CodeConf 2015 - Your WebPerf Sucks

Optimising the dependency graph between HTML, CSS, and JavaScript.

Optimising the Critical Rendering

Path

Page 45: HK CodeConf 2015 - Your WebPerf Sucks

Optimising the Critical Rendering

Path

=Ge!ing ! on the

screen fast

Page 46: HK CodeConf 2015 - Your WebPerf Sucks

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

Page 47: HK CodeConf 2015 - Your WebPerf Sucks

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.

Page 48: HK CodeConf 2015 - Your WebPerf Sucks

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).

Page 49: HK CodeConf 2015 - Your WebPerf Sucks
Page 50: HK CodeConf 2015 - Your WebPerf Sucks
Page 51: HK CodeConf 2015 - Your WebPerf Sucks

Tools

Page 52: HK CodeConf 2015 - Your WebPerf Sucks

Performance Testing

http://www.webpagetest.org

Page 53: HK CodeConf 2015 - Your WebPerf Sucks

http://tools.pingdom.com/fpt/

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

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

Performance Testing

Page 54: HK CodeConf 2015 - Your WebPerf Sucks

Chrome Dev Tools

Page 55: HK CodeConf 2015 - Your WebPerf Sucks

Perf-Tooling Today

http://perf-tooling.today

Page 56: HK CodeConf 2015 - Your WebPerf Sucks

Perf Rocks

http://perf.rocks

Page 57: HK CodeConf 2015 - Your WebPerf Sucks

Perf School

github.com/bevacqua/perfschool

Page 58: HK CodeConf 2015 - Your WebPerf Sucks

With achieving fast page load time, people can quickly use your site and

accomplish what they want.

Page 59: HK CodeConf 2015 - Your WebPerf Sucks

People will appreciate it and end up being happier users.

Page 60: HK CodeConf 2015 - Your WebPerf Sucks

Happier users mean be!er conversion rates.

Be!er conversion rates can be increased revenue, more signups,

returning visits, or downloads.

Page 61: HK CodeConf 2015 - Your WebPerf Sucks

Let’s make the web less !

So…

Page 62: HK CodeConf 2015 - Your WebPerf Sucks

Thanks!

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