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

What's hot (19)

PPTX
Optimizing Your WordPress Site: Why speed matters, and how to get there
Stephen Bell
 
PPTX
Iasi code camp 12 october 2013 responsive images in the wild-vlad zelinschi
Codecamp Romania
 
PDF
High Performance Images in WordPress
keithdevon
 
PPTX
Library 2.0 : Weblogs : Wordpress
Nurhazman Abdul Aziz
 
PDF
Measuring Web Performance
Dave Olsen
 
PDF
Introduce Bootstrap 3 to Develop Responsive Design Application
eXo Platform
 
PDF
Google enhanced imaging
Uday Kandpal
 
PPTX
Untangling the web10
Derek Jacoby
 
PDF
Bootstrap 3 Basic - Bangkok WordPress Meetup
Woratana Perth Ngarmtrakulchol
 
PDF
Animations on Fire - Making Web animations fast
brianskold
 
PPTX
Website terminology ppt
jude.holmes
 
PPTX
Untangling the web9
Derek Jacoby
 
PPT
How to create a prezi presentation
lechar72
 
PDF
Serious Animation (an introduction to Web Animations)
brianskold
 
PPTX
Untangling8
Derek Jacoby
 
PPT
Face Your Manga
Beth Gallaway
 
PPTX
Untangling spring week8
Derek Jacoby
 
PPTX
Building a PWA - For Everyone Who Is Scared To
Raymond Camden
 
PDF
jQuery Conference San Diego 2014 - Web Performance
dmethvin
 
Optimizing Your WordPress Site: Why speed matters, and how to get there
Stephen Bell
 
Iasi code camp 12 october 2013 responsive images in the wild-vlad zelinschi
Codecamp Romania
 
High Performance Images in WordPress
keithdevon
 
Library 2.0 : Weblogs : Wordpress
Nurhazman Abdul Aziz
 
Measuring Web Performance
Dave Olsen
 
Introduce Bootstrap 3 to Develop Responsive Design Application
eXo Platform
 
Google enhanced imaging
Uday Kandpal
 
Untangling the web10
Derek Jacoby
 
Bootstrap 3 Basic - Bangkok WordPress Meetup
Woratana Perth Ngarmtrakulchol
 
Animations on Fire - Making Web animations fast
brianskold
 
Website terminology ppt
jude.holmes
 
Untangling the web9
Derek Jacoby
 
How to create a prezi presentation
lechar72
 
Serious Animation (an introduction to Web Animations)
brianskold
 
Untangling8
Derek Jacoby
 
Face Your Manga
Beth Gallaway
 
Untangling spring week8
Derek Jacoby
 
Building a PWA - For Everyone Who Is Scared To
Raymond Camden
 
jQuery Conference San Diego 2014 - Web Performance
dmethvin
 

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

PDF
Performance.now() fast but not furious
Anna Migas
 
PDF
HalfStack fast but not furious
Anna Migas
 
PDF
Fast but not furious: debugging user interaction performance issues
Anna Migas
 
PDF
Front-end optimisation & jQuery Internals (Pycon)
Artur Cistov
 
PPTX
Netflix Webkit-Based UI for TV Devices
Matt McCarthy
 
PDF
Front-end optimisation & jQuery Internals
Artur Cistov
 
PDF
PrairieDevCon 2014 - Web Doesn't Mean Slow
dmethvin
 
PDF
Performance beyond page load - CSS Conf Asia 2015
Apoorv Saxena
 
PDF
Practical tipsmakemobilefaster oscon2016
Doris Chen
 
PDF
Google IO 2013: Web Performance Matters
Mitch Chen
 
PDF
Qt WebKit going Mobile
Kenneth Rohde Christiansen
 
PDF
Performance (browser)
aquarius070287
 
PDF
Hacking to be performant
Apoorv Saxena
 
PDF
#Webperf Choreography
Harald Kirschner
 
PPTX
Optimizing Browser Rendering
michael.labriola
 
KEY
Faster Frontends
Andy Davies
 
PDF
Web Zurich - Make your animations perform well
Anna Migas
 
PPTX
Web performance
Samir Das
 
PPTX
Building high performing web pages
Nilesh Bafna
 
PDF
jQuery Conference Toronto
dmethvin
 
Performance.now() fast but not furious
Anna Migas
 
HalfStack fast but not furious
Anna Migas
 
Fast but not furious: debugging user interaction performance issues
Anna Migas
 
Front-end optimisation & jQuery Internals (Pycon)
Artur Cistov
 
Netflix Webkit-Based UI for TV Devices
Matt McCarthy
 
Front-end optimisation & jQuery Internals
Artur Cistov
 
PrairieDevCon 2014 - Web Doesn't Mean Slow
dmethvin
 
Performance beyond page load - CSS Conf Asia 2015
Apoorv Saxena
 
Practical tipsmakemobilefaster oscon2016
Doris Chen
 
Google IO 2013: Web Performance Matters
Mitch Chen
 
Qt WebKit going Mobile
Kenneth Rohde Christiansen
 
Performance (browser)
aquarius070287
 
Hacking to be performant
Apoorv Saxena
 
#Webperf Choreography
Harald Kirschner
 
Optimizing Browser Rendering
michael.labriola
 
Faster Frontends
Andy Davies
 
Web Zurich - Make your animations perform well
Anna Migas
 
Web performance
Samir Das
 
Building high performing web pages
Nilesh Bafna
 
jQuery Conference Toronto
dmethvin
 
Ad

More from Anna Migas (11)

PDF
Thinking Beyond Core Web Vitals - Web performance optimisations for the harsh...
Anna Migas
 
PDF
Demystifying web performance tooling and metrics
Anna Migas
 
PDF
Secret Web Performance Metric - DevDayBe
Anna Migas
 
PDF
Web performance optimisations for the harsh conditions.pdf
Anna Migas
 
PDF
Secret performance metric - Modern Frontends
Anna Migas
 
PDF
Secret Performance Metric - Armada JS.pdf
Anna Migas
 
PDF
The secret web performance metric no one is talking about
Anna Migas
 
PDF
HalfStack London - Make Your Animations Perform Well
Anna Migas
 
PDF
Make Your Animations Perform Well - JS Conf Budapest 2017
Anna Migas
 
PDF
Make your animations perform well
Anna Migas
 
PDF
Be brave and Open Source
Anna Migas
 
Thinking Beyond Core Web Vitals - Web performance optimisations for the harsh...
Anna Migas
 
Demystifying web performance tooling and metrics
Anna Migas
 
Secret Web Performance Metric - DevDayBe
Anna Migas
 
Web performance optimisations for the harsh conditions.pdf
Anna Migas
 
Secret performance metric - Modern Frontends
Anna Migas
 
Secret Performance Metric - Armada JS.pdf
Anna Migas
 
The secret web performance metric no one is talking about
Anna Migas
 
HalfStack London - Make Your Animations Perform Well
Anna Migas
 
Make Your Animations Perform Well - JS Conf Budapest 2017
Anna Migas
 
Make your animations perform well
Anna Migas
 
Be brave and Open Source
Anna Migas
 
Ad

Recently uploaded (20)

PPT
introduction to networking with basics coverage
RamananMuthukrishnan
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PPT
introductio to computers by arthur janry
RamananMuthukrishnan
 
PDF
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PDF
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
PPTX
internet básico presentacion es una red global
70965857
 
PDF
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
PPTX
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
PPTX
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPT
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 
PPT
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PPT
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
introduction to networking with basics coverage
RamananMuthukrishnan
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
introductio to computers by arthur janry
RamananMuthukrishnan
 
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
Orchestrating things in Angular application
Peter Abraham
 
internet básico presentacion es una red global
70965857
 
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 

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