SlideShare a Scribd company logo
Front-end Dev & Designer
at Lunar Logic
Anna Migas
Google Developer Expert
@szynszyliszys
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?
Performance.now()   fast but not furious
!
"
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
main thread (UI)
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 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. Use requestAnimationFrame()
requestAnimationFrame
function repeated() {
// show something many times
window.requestAnimationFrame(repeated);
}
window.requestAnimationFrame(repeated);
Animations
1. Don’t overuse animations
2. Animate only transform and opacity if possible
3. Use requestAnimationFrame() but…
4. …for 120fps avoid requestAnimationFrame()
5. Don’t animate elements below other nodes (like
fixed headers)
6. 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
Performance.now()   fast but not furious
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
Performance.now()   fast but not furious
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. Lazy loading is tricky
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:	url(“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: lazy loading
7c
https://enviragallery.com
Images: lazy loading
• There are situations when it can make the
experience worse because of reflows
• https://jobs.zalando.com/tech/blog/loading-
time-matters/index.html
• Placeholders can be a solution (eg. Low Quality
Placeholders)
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
8. https://developers.google.com/web/tools/chrome-devtools/speed/get-
started
Thanks!
Anna Migas
@szynszyliszys

More Related Content

PPTX
Make JavaScript Faster
PDF
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...
PPTX
How I learned to stop worrying and love UX metrics
PDF
Progressive Web App Challenges
PDF
Happy Browser, Happy User! NY Web Performance Meetup 9/20/19
PDF
High Performance Web - Full Stack Toronto
PPTX
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
PDF
Responsive Images and Performance
Make JavaScript Faster
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...
How I learned to stop worrying and love UX metrics
Progressive Web App Challenges
Happy Browser, Happy User! NY Web Performance Meetup 9/20/19
High Performance Web - Full Stack Toronto
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
Responsive Images and Performance

What's hot (20)

PDF
Improving frontend performance
PDF
17 Web Performance Metrics You Should Care About
PDF
Keep the Web Fast
PPTX
10 things you can do to speed up your web app today 2016
PDF
Measuring Web Performance (HighEdWeb FL Edition)
PDF
Optimizing web performance (Fronteers edition)
PDF
Hacking Web Performance @ ForwardJS 2017
PPTX
Html5 Fit: Get Rid of Love Handles
PDF
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...
PPTX
Web Performance: 3 Stages to Success
PDF
Web Unleashed '19 - Measuring the Adoption of Web Performance Techniques
PDF
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018
PDF
Guide to WordPress Speed Optimization by WP Villa
PPTX
2021 Chrome Dev Summit: Web Performance 101
PPTX
How webpage loading takes place?
PPTX
Satisfying the Need for Speed (By Aleh Barysevich of SEO PowerSuite, SMX Lond...
PDF
2017 Silicon Valley Code Camp: Instant Mobile Web
PDF
Hacking Web Performance
PDF
Planning Your Progressive Web App
PDF
Mobile Web Speed Bumps
Improving frontend performance
17 Web Performance Metrics You Should Care About
Keep the Web Fast
10 things you can do to speed up your web app today 2016
Measuring Web Performance (HighEdWeb FL Edition)
Optimizing web performance (Fronteers edition)
Hacking Web Performance @ ForwardJS 2017
Html5 Fit: Get Rid of Love Handles
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...
Web Performance: 3 Stages to Success
Web Unleashed '19 - Measuring the Adoption of Web Performance Techniques
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018
Guide to WordPress Speed Optimization by WP Villa
2021 Chrome Dev Summit: Web Performance 101
How webpage loading takes place?
Satisfying the Need for Speed (By Aleh Barysevich of SEO PowerSuite, SMX Lond...
2017 Silicon Valley Code Camp: Instant Mobile Web
Hacking Web Performance
Planning Your Progressive Web App
Mobile Web Speed Bumps
Ad

Similar to Performance.now() fast but not furious (20)

PDF
Fullstack 2018 - Fast but not furious: debugging user interaction performanc...
PDF
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
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
Web Zurich - Make your animations perform well
PDF
HalfStack London - Make Your Animations Perform Well
PDF
Responsive & Responsible: Implementing Responsive Design at Scale
PDF
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
PDF
Measuring Web Performance - HighEdWeb Edition
PDF
Make your animations perform well - Anna Migas - Codemotion Rome 2017
PPTX
Getting Intimate with Images on Android with James Halpern
PDF
Make Your Animations Perform Well - JS Conf Budapest 2017
KEY
HTML CSS & Javascript
PPT
Mobile Monday Presentation: Responsive Web Design
PDF
jQuery Conference San Diego 2014 - Web Performance
PDF
Playwright Visual Testing Best Practices, presented by Applitools
PDF
Make your animations perform well
PDF
Design Fast Websites
PDF
Rwd slidedeck
Fullstack 2018 - Fast but not furious: debugging user interaction performanc...
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
Fast but not furious: debugging user interaction performance issues
HalfStack fast but not furious
Responsive Web Design: Clever Tips and Techniques
Web Zurich - Make your animations perform well
HalfStack London - Make Your Animations Perform Well
Responsive & Responsible: Implementing Responsive Design at Scale
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
Measuring Web Performance - HighEdWeb Edition
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Getting Intimate with Images on Android with James Halpern
Make Your Animations Perform Well - JS Conf Budapest 2017
HTML CSS & Javascript
Mobile Monday Presentation: Responsive Web Design
jQuery Conference San Diego 2014 - Web Performance
Playwright Visual Testing Best Practices, presented by Applitools
Make your animations perform well
Design Fast Websites
Rwd slidedeck
Ad

More from Anna Migas (8)

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
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
Be brave and Open Source

Recently uploaded (20)

PPTX
SAP Ariba Sourcing PPT for learning material
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
Testing WebRTC applications at scale.pdf
PPTX
artificial intelligence overview of it and more
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PPTX
Introduction to Information and Communication Technology
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
DOCX
Unit-3 cyber security network security of internet system
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
The Internet -By the Numbers, Sri Lanka Edition
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
innovation process that make everything different.pptx
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
SAP Ariba Sourcing PPT for learning material
Decoding a Decade: 10 Years of Applied CTI Discipline
Testing WebRTC applications at scale.pdf
artificial intelligence overview of it and more
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
522797556-Unit-2-Temperature-measurement-1-1.pptx
SASE Traffic Flow - ZTNA Connector-1.pdf
PptxGenJS_Demo_Chart_20250317130215833.pptx
Introduction to Information and Communication Technology
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Cloud-Scale Log Monitoring _ Datadog.pdf
Unit-3 cyber security network security of internet system
INTERNET------BASICS-------UPDATED PPT PRESENTATION
RPKI Status Update, presented by Makito Lay at IDNOG 10
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
The Internet -By the Numbers, Sri Lanka Edition
international classification of diseases ICD-10 review PPT.pptx
innovation process that make everything different.pptx
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx

Performance.now() fast but not furious