65

Building for, perceiving and measuring performance for mobile web

Embed Size (px)

Citation preview

Page 1: Building for, perceiving and measuring performance for mobile web
Page 2: Building for, perceiving and measuring performance for mobile web

Robin GlenPrincipal Developer

YOOX NET-A-PORTER GROUP@arielwithlegs

Page 3: Building for, perceiving and measuring performance for mobile web

Building for, perceiving and measuring performance

for mobile web

Page 4: Building for, perceiving and measuring performance for mobile web

MPAs“Multiple-page applications work in a ‘traditional’ way. Every change e.g. display the data or submit data back to server requests rendering a new page from the server in the browser.” - Paweł Skólsk

https://goo.gl/7Zjyh8

Page 5: Building for, perceiving and measuring performance for mobile web

SPAs

https://goo.gl/7Zjyh8

“A single-page application is an app that works inside a browser and does not require page reloading during use.”- Paweł Skólsk

Page 6: Building for, perceiving and measuring performance for mobile web

Why websites moved towards SPAs

Page 7: Building for, perceiving and measuring performance for mobile web

Why websites moved towards SPAs

Native like experience

Page 8: Building for, perceiving and measuring performance for mobile web

Why companies moving towards SPAsWhy websites moved towards SPAs

Less dataconsumption

Page 9: Building for, perceiving and measuring performance for mobile web

Why websites moved towards SPAs

Less battery usage

Page 10: Building for, perceiving and measuring performance for mobile web

Why companies moving towards SPAsWhy websites moved towards SPAs

More performant*MPA pagination with simulated 3G network

MPA*Potentially

Page 11: Building for, perceiving and measuring performance for mobile web

Why companies moving towards SPAsWhy websites moved towards SPAs

More performant*SPA pagination with simulated 3G network

SPA*Potentially

Page 12: Building for, perceiving and measuring performance for mobile web

However, these gains are dependant on a performant API

Page 13: Building for, perceiving and measuring performance for mobile web

https://goo.gl/CahHPp

SPAs vs MPAsWith extremely large datasets

Page 14: Building for, perceiving and measuring performance for mobile web

How you can help ensure performant SPAs

Page 15: Building for, perceiving and measuring performance for mobile web

How you can help ensure performant SPAs

API basics

Page 16: Building for, perceiving and measuring performance for mobile web

How you can help ensure performant SPAs

API basics- Compression

Page 17: Building for, perceiving and measuring performance for mobile web

How you can help ensure performant SPAs

API basics- Compression- CDN (get closer to customers)

Page 18: Building for, perceiving and measuring performance for mobile web

- Compression- CDN (get closer to customers)- Cut down on bloat

API basicsHow you can help ensure performant SPAs

Page 19: Building for, perceiving and measuring performance for mobile web

API advancedHow you can help ensure performant SPAs

Page 20: Building for, perceiving and measuring performance for mobile web

- Selectable properties (partial response)

API advancedHow you can help ensure performant SPAs

Page 21: Building for, perceiving and measuring performance for mobile web

- Selectable properties (partial response)- Client hints

API advancedHow you can help ensure performant SPAs

Page 22: Building for, perceiving and measuring performance for mobile web

- Selectable properties (partial response)- Client hints- Streams

API advancedHow you can help ensure performant SPAs

Page 23: Building for, perceiving and measuring performance for mobile web

https://goo.gl/UizzKD

- Selectable properties (partial response)- Client hints- Streams

API advancedHow you can help ensure performant SPAs

Page 24: Building for, perceiving and measuring performance for mobile web

ApplicationHow you can help ensure performant SPAs

Page 25: Building for, perceiving and measuring performance for mobile web

- Ship less code

ApplicationHow you can help ensure performant SPAs

Page 26: Building for, perceiving and measuring performance for mobile web

- Ship less code- HTTP/2

ApplicationHow you can help ensure performant SPAs

Page 27: Building for, perceiving and measuring performance for mobile web

- Ship less code- HTTP/2- Offline first

ApplicationHow you can help ensure performant SPAs

Page 28: Building for, perceiving and measuring performance for mobile web

- Ship less code- HTTP/2- Offline first- Trick your customers

ApplicationHow you can help ensure performant SPAs

Page 29: Building for, perceiving and measuring performance for mobile web

Perceived performance

Page 30: Building for, perceiving and measuring performance for mobile web

Famous example

iOSLoad image of app’s last state

Page 31: Building for, perceiving and measuring performance for mobile web

Applying perceived performance to the web

Page 32: Building for, perceiving and measuring performance for mobile web

Perceived performance

White screenSynchronous loading of contentover slow 3G connection

Page 33: Building for, perceiving and measuring performance for mobile web

Perceived performance

SpinnerAsynchronous loading of contentover slow 3G connection

Page 34: Building for, perceiving and measuring performance for mobile web

Perceived performance

Skeleton CSSAsynchronous loading of contentover slow 3G connection

Page 35: Building for, perceiving and measuring performance for mobile web

Spinner vs Skeleton

Page 36: Building for, perceiving and measuring performance for mobile web

Measuring performance

Page 37: Building for, perceiving and measuring performance for mobile web

We build mobile first, but measuring performance should be mobile only

Page 38: Building for, perceiving and measuring performance for mobile web

Measuring performance

RAILPerformance budgets

Page 39: Building for, perceiving and measuring performance for mobile web

Measuring performance

RAIL Instant feedbackInput latency < 100ms

Performance budgets

Page 40: Building for, perceiving and measuring performance for mobile web

Measuring performance

RAIL Instant feedbackInput latency < 100ms

Run at 60fpsEach frame’s work < 16ms

Performance budgets

Page 41: Building for, perceiving and measuring performance for mobile web

Measuring performance

RAIL Instant feedbackInput latency < 100ms

Run at 60fpsEach frame’s work < 16ms

Schedule work Main thread work chunked < 50ms

Performance budgets

Page 42: Building for, perceiving and measuring performance for mobile web

Measuring performance

RAIL Instant feedbackInput latency < 100ms

Run at 60fpsEach frame’s work < 16ms

Schedule work Main thread work chunked < 50ms

Render critical path < 1000ms

Performance budgets

Page 43: Building for, perceiving and measuring performance for mobile web

https://goo.gl/C2x54g

Measuring performance

RAIL Instant feedbackInput latency < 100ms

Run at 60fpsEach frame’s work < 16ms

Schedule work Main thread work chunked < 50ms

Render critical path < 1000ms

Performance budgets

Page 44: Building for, perceiving and measuring performance for mobile web

We have tools to help

Page 45: Building for, perceiving and measuring performance for mobile web

Measuring performance

Chrome devtools Performance tab, throttle network and CPU

Page 46: Building for, perceiving and measuring performance for mobile web

https://goo.gl/3KeEKQ

Measuring performance

RAPIP Mobile API performance tool

Page 47: Building for, perceiving and measuring performance for mobile web

“If you can’t measure it, you can’t improve it”

Page 48: Building for, perceiving and measuring performance for mobile web

“If you can’t measure it, you can’t improve it”

Robin Glen

Page 49: Building for, perceiving and measuring performance for mobile web

“If you can’t measure it, you can’t improve it”

Robin GlenPeter Drucker

Page 50: Building for, perceiving and measuring performance for mobile web

Monitoring performance

Page 51: Building for, perceiving and measuring performance for mobile web

DOM complete is a blunt instrument

Page 52: Building for, perceiving and measuring performance for mobile web

Monitoring performance

RAILChrome performanceAPIs

Page 53: Building for, perceiving and measuring performance for mobile web

Monitoring performance

RAIL Interaction response timingsPerformance mark / measure (Chome 43+)

Chrome performanceAPIs

Page 54: Building for, perceiving and measuring performance for mobile web

Monitoring performance

RAIL Interaction response timingsPerformance mark / measure (Chome 43+)

Long tasks / dropped framesPerformanceLongTaskTiming (Chrome 58+)

Chrome performanceAPIs

Page 55: Building for, perceiving and measuring performance for mobile web

Monitoring performance

RAIL Interaction response timingsPerformance mark / measure (Chome 43+)

Long tasks / dropped framesPerformanceLongTaskTiming (Chrome 58+)

First paint / First contentful paintPerformanceObserver (Chrome 60+)

Chrome performanceAPIs

Page 56: Building for, perceiving and measuring performance for mobile web

Monitoring performance

RAIL Interaction response timingsPerformance mark / measure (Chome 43+)

Long tasks / dropped framesPerformanceLongTaskTiming (Chrome 58+)

First paint / First contentful paintPerformanceObserver (Chrome 60+)

Chrome performanceAPIs

Hero elementsCurrently being worked on

Page 57: Building for, perceiving and measuring performance for mobile web

Monitoring performance

RAIL Interaction response timingsPerformance mark / measure (Chome 43+)

Long tasks / dropped framesPerformanceLongTaskTiming (Chrome 58+)

First paint / First contentful paintPerformanceObserver (Chrome 60+)

Chrome performanceAPIs

Hero elementsCurrently being worked on Time to interactivePolyfill https://goo.gl/YNbcU7

Page 58: Building for, perceiving and measuring performance for mobile web

Monitoring performance

RAIL Interaction response timingsPerformance mark / measure (Chome 43+)

Long tasks / dropped framesPerformanceLongTaskTiming (Chrome 58+)

First paint / First contentful paintPerformanceObserver (Chrome 60+)

Chrome performanceAPIs

Hero elementsCurrently being worked on Time to interactivePolyfill https://goo.gl/YNbcU7 https://goo.gl/iKifq9

Page 59: Building for, perceiving and measuring performance for mobile web

Performance metrics are not a number, they

are a histogram

Page 60: Building for, perceiving and measuring performance for mobile web

Time (ms)

Load metrics

https://goo.gl/iKifq9

Page 61: Building for, perceiving and measuring performance for mobile web

Finally

Page 62: Building for, perceiving and measuring performance for mobile web

One surefire way to ruin your website performance

Page 63: Building for, perceiving and measuring performance for mobile web

Unregulated marketing tags!

Page 64: Building for, perceiving and measuring performance for mobile web

Performance killers

TagsName and shame withthird party attributions

Page 65: Building for, perceiving and measuring performance for mobile web

ThanksRobin Glen

Principal DeveloperYOOX NET-A-PORTER GROUP

@arielwithlegs