SlideShare a Scribd company logo
Front-end Dev & Designer
at Lunar Logic
Anna Migas
Google Developer Expert
Anna Migas
@szynszyliszys
Fast but not furious:
Debugging user interaction
performance issues
Starability.css
Repaintless.css Auroral.css
Perceived performance
Perceived performance
First Meaningful Paint
Time to interactive
Optimise Critical Rendering Path
Optimise Critical Rendering Path
Use progress bars instead of spinners
Optimise Critical Rendering Path
Use progress bars instead of spinners
Have a placeholder content
Optimise Critical Rendering Path
Use progress bars instead of spinners
Have a placeholder content
Start upload before user even
decides to click the upload button
Perceived Performance?
Fullstack 2018 -  Fast but not furious: debugging user interaction performance issues
!
"
Perceived Performance
LOADPerceived Performance
!
"
Perceived load performance
!
Perceived performance
!
Perceived performance
First Meaningful Paint
Time to interactive
Smooth at all times
Agenda
1. Why sometimes interactions feel slow
2. Browser rendering and frames
3. Types of triggered changes in the UI
4. How to test for interaction performance
5. Potentially dangerous user interface patterns
J A N K
zdjΔ™cie krzeseΕ‚
https://jakearchibald.github.io/jank-invaders/
60 fps 

1000/60 = ~16.6ms
60 fps 

1000/60 = ~16.6ms
120 fps 

1000/120 = ~8.3ms
iPad Pro, Razer smartphone
How can we help the browser
to make it on time?
Offload the main thread
BUS
main thread (UI)
background thread (heavy task)
Offload the main thread
1. Use Web Workers for heavy tasks
2. Optimise the main thread
Offload the main thread
1. Use Web Workers for heavy tasks
2. Optimise the main thread
If we interact with a page, a browser
needs to start serving frames
(ideally 60 or 120 per second)
What a frame consists of?
What a browser does during these
steps?
Change happens, an event is fired
1
Styles are recalculated
2
Layout is calculated
3
Layout
Everything is rasterised
and painted to the layers
4
Paint
Paint
Layers
What creates new layers?
1. 3D or perspective transforms
2. Animated 2D transforms or opacity
3. Being on top/a child of a compositing layer
4. Accelerated CSS filters
5. In special cases <video>, <canvas>, plugins
6. will-change CSS property
.btn	{		
		background-color:	white;	
		border:	1px	solid	blue;	
		will-change:	transform;	
}	
.btn:hover	{	
	transform:	scale(1.1);	
}
Every layer consumes memory.
Use them wisely.
Compositing
5
Compositing
Compositing
Types of triggered changes
Layout change (Reflow)
(width, margin-top, left)
Paint change (Repaint)
(background-color, box-shadow, background-image)
Compositing change
(transform, opacity)
How to test if we have a problem?
Reflows
Reflows can be quite obvious…
…but for Repaints we might need
better tools
Performance tab (Chrome or Firefox)
Performance tab (Chrome or Firefox)
Layers tab (Chrome)
Rendering tab (Chrome)
Rendering tab (Chrome)
Paint flashing (Firefox)
Performance monitor tab (Chrome)
What are the potentially dangerous
UI patterns?
Animations
1
Animations
1. Don’t overuse animations
2. Animate only transform and opacity if possible
3. For 120fps avoid requestAnimationFrame()
4. Don’t animate elements below other nodes (like
fixed headers)
5. Don’t animate too many elements
Parallax effect
2
http://davegamache.com/parallax/
Parallax effect
1. Causes Paint Storms
2. Almost always bad
3. Don’t use scroll events
4. Don’t use background-position
5. Use 3D transforms and perspective if you need
to: https://developers.google.com/web/updates/
2016/12/performant-parallaxing
Fixed elements
3
https://jsipsum.lunarlogic.io/
Fixed elements
1. Repaints with every frame when scrolling
2. Use will-change property (or transform:	
translate3D(0,0,0)) to avoid repainting
.fixed-element	{	
		position:	fixed;	
		will-change:	transform;			
}
Scrolling events
4
Scrolling events
1. Don’t attach wheel or touch listeners to the whole
document, use smaller areas instead
2. Take advantage of passive event listeners (use
with polyfill):
window.addEventListener("scroll",	func,	{passive:	true});
Hover effects
5
Fullstack 2018 -  Fast but not furious: debugging user interaction performance issues
Hover effects
1. If they are bound to happen oftenβ€”you might
consider using will-change property
2. Can be deadly if there are too many and can be
easily triggered
3. Avoid effects triggering Layout or Paint:
https://csstriggers.com/
Appending elements
6
Fullstack 2018 -  Fast but not furious: debugging user interaction performance issues
Appending elements
1. Make sure not many elements will be affected
2. Try to separate the area (will-change, contain:	
layout)
3. Try not to change the size of area (for example
use overflow property)
Images
7
https://unsplash.com/ (on slow 3G)
Images
A. Can be downloaded in unexpected ways
B. Can cause content jumps on load
C. Often are optimised incorrectly
Images: downloads
7a
Images: downloads
β€’ Semantics = performance
β€’ How image is embedded (img tag/background-
image) influences the time of download
β€’ Comprehensive research by Harry Roberts
Images: downloads (img tag)
<img	src=β€œimage.png”	alt=β€œAlt	text”>
Images: downloads (background img)
background-image:	β€œimage.png”;
Images: content jumps
7b
http://aspiringwebdev.com
Images: content jumps
β€’ No jumps in Chrome any more (scroll anchoring
enabled by default in Chrome 56)
β€’ Can be avoided by using a placeholder content eg.
created with the intristic ratio:
img-height / img-width * 100%
.container	{	
		padding-bottom:	$intristic-ratio;	
		height:	0;	
		overflow:	hidden;			
}
Images: optimisation
7c
Images: optimisation
β€’ Less images = better performance
β€’ Use correct format
β€’ Make sure optimisation is the very last step (see
@kornelski https://pitercss.com/ talk once it is
released)
Takeaways
1. Jank happens when the browser doesn’t finish
rendering a frame on time
2. Try to offload and optimise the main thread
3. Avoid content Reflows and Repaints
4. Don’t overuse layers
5. Test your website with Performance, Layers and
Rendering tabs
6. Use responsibly potentially dangerous UI patterns
Resources
1. http://jankfree.org
2. https://dev.opera.com/articles/css-will-change-property
3. https://www.udacity.com/course/browser-rendering-optimization--
ud860
4. https://www.html5rocks.com/en/tutorials/speed/layers
5. https://www.html5rocks.com/en/tutorials/speed/high-performance-
animations
6. https://blog.logrocket.com/eliminate-content-repaints-with-the-new-
layers-panel-in-chrome-e2c306d4d752
7. https://dassur.ma/things/120fps/
Thanks!
Anna Migas
@szynszyliszys

More Related Content

PDF
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
PDF
Building a game engine with jQuery
PDF
Optimizing for a faster user experience Pt 2: How-to.
PPTX
Advanced Power Point 1
PPTX
Web Performance: 3 Stages to Success
PPTX
Web performance
PPTX
What's New in Bootstrap 5
PPTX
Speed up your site! #wcmtl2015 by Meagan Hanes
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
Building a game engine with jQuery
Optimizing for a faster user experience Pt 2: How-to.
Advanced Power Point 1
Web Performance: 3 Stages to Success
Web performance
What's New in Bootstrap 5
Speed up your site! #wcmtl2015 by Meagan Hanes

What's hot (19)

PPTX
Optimizing Your WordPress Site: Why speed matters, and how to get there
PPTX
Iasi code camp 12 october 2013 responsive images in the wild-vlad zelinschi
PDF
High Performance Images in WordPress
PPTX
Library 2.0 : Weblogs : Wordpress
PDF
Measuring Web Performance
PDF
Introduce Bootstrap 3 to Develop Responsive Design Application
PDF
Google enhanced imaging
PPTX
Untangling the web10
PDF
Bootstrap 3 Basic - Bangkok WordPress Meetup
PDF
Animations on Fire - Making Web animations fast
PPTX
Website terminology ppt
PPTX
Untangling the web9
PPT
How to create a prezi presentation
PDF
Serious Animation (an introduction to Web Animations)
PPTX
Untangling8
PPT
Face Your Manga
PPTX
Untangling spring week8
PPTX
Building a PWA - For Everyone Who Is Scared To
PDF
jQuery Conference San Diego 2014 - Web Performance
Optimizing Your WordPress Site: Why speed matters, and how to get there
Iasi code camp 12 october 2013 responsive images in the wild-vlad zelinschi
High Performance Images in WordPress
Library 2.0 : Weblogs : Wordpress
Measuring Web Performance
Introduce Bootstrap 3 to Develop Responsive Design Application
Google enhanced imaging
Untangling the web10
Bootstrap 3 Basic - Bangkok WordPress Meetup
Animations on Fire - Making Web animations fast
Website terminology ppt
Untangling the web9
How to create a prezi presentation
Serious Animation (an introduction to Web Animations)
Untangling8
Face Your Manga
Untangling spring week8
Building a PWA - For Everyone Who Is Scared To
jQuery Conference San Diego 2014 - Web Performance
Ad

Similar to Fullstack 2018 - Fast but not furious: debugging user interaction performance issues (20)

PDF
Performance.now() fast but not furious
PDF
Fast but not furious: debugging user interaction performance issues
PDF
HalfStack fast but not furious
PDF
Responsive Web Design: Clever Tips and Techniques
PDF
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
Β 
PDF
Responsive & Responsible: Implementing Responsive Design at Scale
PDF
Web Zurich - Make your animations perform well
KEY
HTML CSS & Javascript
PDF
HalfStack London - Make Your Animations Perform Well
PDF
Rwd slidedeck
PDF
Responsive Web Design tips and tricks.
PDF
Design Fast Websites
PPT
Mobile Monday Presentation: Responsive Web Design
PDF
Make your animations perform well - Anna Migas - Codemotion Rome 2017
PPTX
Getting Intimate with Images on Android with James Halpern
Β 
PPTX
Graphics on the Go
PDF
Make Your Animations Perform Well - JS Conf Budapest 2017
PDF
Measuring Web Performance - HighEdWeb Edition
PDF
Playwright Visual Testing Best Practices, presented by Applitools
PDF
Html 5 mobile - nitty gritty
Performance.now() fast but not furious
Fast but not furious: debugging user interaction performance issues
HalfStack fast but not furious
Responsive Web Design: Clever Tips and Techniques
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
Β 
Responsive & Responsible: Implementing Responsive Design at Scale
Web Zurich - Make your animations perform well
HTML CSS & Javascript
HalfStack London - Make Your Animations Perform Well
Rwd slidedeck
Responsive Web Design tips and tricks.
Design Fast Websites
Mobile Monday Presentation: Responsive Web Design
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Getting Intimate with Images on Android with James Halpern
Β 
Graphics on the Go
Make Your Animations Perform Well - JS Conf Budapest 2017
Measuring Web Performance - HighEdWeb Edition
Playwright Visual Testing Best Practices, presented by Applitools
Html 5 mobile - nitty gritty
Ad

More from Anna Migas (9)

PDF
Thinking Beyond Core Web Vitals - Web performance optimisations for the harsh...
PDF
Demystifying web performance tooling and metrics
PDF
Secret Web Performance Metric - DevDayBe
PDF
Web performance optimisations for the harsh conditions.pdf
PDF
Secret performance metric - Modern Frontends
PDF
Secret Performance Metric - Armada JS.pdf
PDF
The secret web performance metric no one is talking about
PDF
Make your animations perform well
PDF
Be brave and Open Source
Thinking Beyond Core Web Vitals - Web performance optimisations for the harsh...
Demystifying web performance tooling and metrics
Secret Web Performance Metric - DevDayBe
Web performance optimisations for the harsh conditions.pdf
Secret performance metric - Modern Frontends
Secret Performance Metric - Armada JS.pdf
The secret web performance metric no one is talking about
Make your animations perform well
Be brave and Open Source

Recently uploaded (20)

PPTX
Introduction to Information and Communication Technology
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
Β 
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
Β 
PPTX
Funds Management Learning Material for Beg
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
PPTX
Digital Literacy And Online Safety on internet
PPTX
Introuction about WHO-FIC in ICD-10.pptx
Introduction to Information and Communication Technology
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Cloud-Scale Log Monitoring _ Datadog.pdf
RPKI Status Update, presented by Makito Lay at IDNOG 10
Β 
Triggering QUIC, presented by Geoff Huston at IETF 123
Β 
Funds Management Learning Material for Beg
Introuction about ICD -10 and ICD-11 PPT.pptx
SAP Ariba Sourcing PPT for learning material
522797556-Unit-2-Temperature-measurement-1-1.pptx
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
QR Codes Qr codecodecodecodecocodedecodecode
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Sims 4 Historia para lo sims 4 para jugar
Tenda Login Guide: Access Your Router in 5 Easy Steps
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
Digital Literacy And Online Safety on internet
Introuction about WHO-FIC in ICD-10.pptx

Fullstack 2018 - Fast but not furious: debugging user interaction performance issues