Robin Glen
Principal Developer
YOOX NET-A-PORTER GROUP
@arielwithlegs
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
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
Why websites
moved towards SPAs
Why websites moved towards SPAs
Native like experience
Why companies moving towards SPAsWhy websites moved towards SPAs
Less data
consumption
Why websites moved towards SPAs
Less battery usage
Why companies moving towards SPAsWhy websites moved towards SPAs
More performant*
MPA pagination with simulated
3G network
MPA*
Potentially
Why companies moving towards SPAsWhy websites moved towards SPAs
More performant*
SPA pagination with simulated
3G network
SPA*
Potentially
However, these gains are
dependant on a performant API
https://goo.gl/CahHPp
SPAs vs MPAs
With extremely large datasets
How you can help ensure
performant SPAs
How you can help ensure performant SPAs
API basics
How you can help ensure performant SPAs
API basics
- Compression
How you can help ensure performant SPAs
API basics
- Compression
- CDN (get closer to customers)
- Compression
- CDN (get closer to customers)
- Cut down on bloat
API basics
How you can help ensure performant SPAs
API advanced
How you can help ensure performant SPAs
- Selectable properties (partial response)
API advanced
How you can help ensure performant SPAs
- Selectable properties (partial response)
- Client hints
API advanced
How you can help ensure performant SPAs
- Selectable properties (partial response)
- Client hints
- Streams
API advanced
How you can help ensure performant SPAs
https://goo.gl/UizzKD
- Selectable properties (partial response)
- Client hints
- Streams
API advanced
How you can help ensure performant SPAs
Application
How you can help ensure performant SPAs
- Ship less code
Application
How you can help ensure performant SPAs
- Ship less code
- HTTP/2
Application
How you can help ensure performant SPAs
- Ship less code
- HTTP/2
- Offline first
Application
How you can help ensure performant SPAs
- Ship less code
- HTTP/2
- Offline first
- Trick your customers
Application
How you can help ensure performant SPAs
Perceived performance
Famous example
iOS
Load image of app’s last state
Applying perceived performance
to the web
Perceived performance
White screen
Synchronous loading of content
over slow 3G connection
Perceived performance
Spinner
Asynchronous loading of content
over slow 3G connection
Perceived performance
Skeleton CSS
Asynchronous loading of content
over slow 3G connection
Spinner vs Skeleton
Measuring performance
We build mobile first, but
measuring performance
should be mobile only
Measuring performance
RAIL
Performance budgets
Measuring performance
RAIL Instant feedback
Input latency < 100ms
Performance budgets
Measuring performance
RAIL Instant feedback
Input latency < 100ms
Run at 60fps
Each frame’s work < 16ms
Performance budgets
Measuring performance
RAIL Instant feedback
Input latency < 100ms
Run at 60fps
Each frame’s work < 16ms
Schedule work
Main thread work chunked < 50ms
Performance budgets
Measuring performance
RAIL Instant feedback
Input latency < 100ms
Run at 60fps
Each frame’s work < 16ms
Schedule work
Main thread work chunked < 50ms
Render critical path
< 1000ms
Performance budgets
https://goo.gl/C2x54g
Measuring performance
RAIL Instant feedback
Input latency < 100ms
Run at 60fps
Each frame’s work < 16ms
Schedule work
Main thread work chunked < 50ms
Render critical path
< 1000ms
Performance budgets
We have tools to help
Measuring performance
Chrome dev
tools
Performance tab,
throttle network and CPU
https://goo.gl/3KeEKQ
Measuring performance
RAPIP
Mobile API performance tool
“If you can’t measure it,
you can’t improve it”
“If you can’t measure it,
you can’t improve it”
Robin Glen
“If you can’t measure it,
you can’t improve it”
Robin Glen
Peter Drucker
Monitoring performance
DOM complete is
a blunt instrument
Monitoring performance
RAIL
Chrome performance
APIs
Monitoring performance
RAIL Interaction response timings
Performance mark / measure (Chome 43+)
Chrome performance
APIs
Monitoring performance
RAIL Interaction response timings
Performance mark / measure (Chome 43+)
Long tasks / dropped frames
PerformanceLongTaskTiming (Chrome 58+)
Chrome performance
APIs
Monitoring performance
RAIL Interaction response timings
Performance mark / measure (Chome 43+)
Long tasks / dropped frames
PerformanceLongTaskTiming (Chrome 58+)
First paint / First contentful paint
PerformanceObserver (Chrome 60+)
Chrome performance
APIs
Monitoring performance
RAIL Interaction response timings
Performance mark / measure (Chome 43+)
Long tasks / dropped frames
PerformanceLongTaskTiming (Chrome 58+)
First paint / First contentful paint
PerformanceObserver (Chrome 60+)
Chrome performance
APIs
Hero elements
Currently being worked on
Monitoring performance
RAIL Interaction response timings
Performance mark / measure (Chome 43+)
Long tasks / dropped frames
PerformanceLongTaskTiming (Chrome 58+)
First paint / First contentful paint
PerformanceObserver (Chrome 60+)
Chrome performance
APIs
Hero elements
Currently being worked on
Time to interactive
Polyfill https://goo.gl/YNbcU7
Monitoring performance
RAIL Interaction response timings
Performance mark / measure (Chome 43+)
Long tasks / dropped frames
PerformanceLongTaskTiming (Chrome 58+)
First paint / First contentful paint
PerformanceObserver (Chrome 60+)
Chrome performance
APIs
Hero elements
Currently being worked on
Time to interactive
Polyfill https://goo.gl/YNbcU7https://goo.gl/iKifq9
Performance metrics are
not a number, they
are a histogram
Time (ms)
Load metrics
https://goo.gl/iKifq9
Finally
One surefire way to ruin your
website performance
Unregulated marketing tags!
Performance killers
Tags
Name and shame with
third party attributions
Thanks
Robin Glen
Principal Developer
YOOX NET-A-PORTER GROUP
@arielwithlegs

Building for, perceiving and measuring performance for mobile web