profilling client performance

25
Performance on the client side 29 May 2015 Sérgio Laranjeira

Upload: sergio-laranjeira

Post on 26-Jan-2017

544 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Profilling client performance

Performance on the client side

29 May 2015

Sérgio Laranjeira

Page 2: Profilling client performance

Why Fast?

0-100ms 0-300ms 1 second 10 seconds

Bad Experience Never coming back

Page 3: Profilling client performance

Does it matter?Co

nver

sion

Rat

e

0

0,1

0,2

0,3

0,4

Load Time (seconds)

0-1 1-2 2-3 3-4 4-5 5-6 6-7 7-8 8-9 9-10

Page 4: Profilling client performance

Conversion Rate

- 7% percent sales

1 Second Delay

30 million a monthYou are loosing

2.1 million a month 25 million a year

Page 5: Profilling client performance

Seco

nds

to L

oad

7

2013 2014

6,5

5,3

Page Load Time Top 100 e-commerce websites

Page 6: Profilling client performance

Average page size

1995

14Kb 2.3 resources

2010

498Kb 75 resources

2014

1925Kb 100+ resources

2015

2099Kb 130+ resources

Page 7: Profilling client performance

When you want to be fast, you have to give up the things slowing you down

Addy Osmany

Page 8: Profilling client performance

Tools to use

Page 9: Profilling client performance

webpagetest.org

Desktop

Mobile

Page 10: Profilling client performance

Rules of PerformanceRule 1 - Make Fewer HTTP Requests Rule 2 - Use a Content Delivery Network Rule 3 - Add an Expires Header Rule 4 - Gzip Components Rule 5 - Put Stylesheets at the Top Rule 6 - Put Scripts at the Bottom Rule 7 - Avoid CSS Expressions Rule 8 - Make JavaScript and CSS External Rule 9 - Reduce DNS Lookups Rule 10 - Minify JavaScript Rule 11 - Avoid Redirects Rule 12 - Remove Duplicate Scripts Rule 13 - Configure ETags Rule 14 - Make AJAX Cacheable

Page 11: Profilling client performance

HTML 3%Scripts

16%Stylesheeets

3%Video 11%

Fonts 5%

Images 63%

Average bytes per Page

Page 12: Profilling client performance

Images Optimization

grunt-contrib-imagemin grunt-imageoptim

grunt-webp

Page 13: Profilling client performance

Styles

Minified

110kbUnCSS + Minification

11kbOriginal Styles

120kb

Page 14: Profilling client performance

Define your critical path

Page 15: Profilling client performance

HTTP2

Page 16: Profilling client performance

Fonts

Page 17: Profilling client performance

Load font from local Storage

Add the CSS to the page

Add the Font to the local storage

Is the font in the Local Storage already?

Local Storage FontDoes it have support for Local

Storage?

Load font files Fallback Method

Download Font Async

Page 18: Profilling client performance

JavaScript

http://youmightnotneedjquery.com/

http://jsperf.com/

Page 19: Profilling client performance
Page 20: Profilling client performance

Performance BudgetBudget Perfect target

Speed Index <2000 <1000Server Response (TTFB)

ms <450 <300

HTML Errors <20 0DOM Elements <1200 700

Fully Loaded Time <5s 1s

Fully Loaded Bytes <2000kb <1.500Kb

Document Complete Time <3s <1.5s

Performance Grade Desktop / Mobile 80/75 95/90

Page 21: Profilling client performance

Performance is everyones job Optimize, repeat and keep testing Visualize and share results with everyone

Performance Culture

Page 22: Profilling client performance

Perception of fast and performant website is sometimes more important than being actually fast.

Page 23: Profilling client performance

FutureYou will eventually have to rebuild all your system

Everyone at your company will be focused on performance.

Web Technologies will make you have extremely instant experiences.

Page 24: Profilling client performance

It’s a race… you always need to be the fastest

Page 25: Profilling client performance

Thank You [email protected] @serlaranjeira

29 May 2015