SlideShare a Scribd company logo
Chrome DevTools
Rendering & Memory profiling
Open Academy 2013 Mate Nadasdi - Ustream, Inc
WHY DO WE NEED
A DEVTOOL?
• Javascript is an interpreted language
• HTML, CSS debugging have to happen in the browser
• Logging, debugging network requests is essential
• Source and the final output could be totally different
• Performance optimization is becoming increasingly important,
especially on mobile
Google is leading in new technologies
Native implementation and really fast support
Canary build deliver new features in really short intervals
Deep configuration possibilites
Early experimental access
Rendering / Memory Profiling tools
Why Google Chrome?
Red - Yellow - Blue?
Chrome channels
• Stable (Releases in every 6 weeks)
• Beta (1 month before stable, weekly releases)
• Dev (twice weekly)
• Canary (daily)
Chromium
Rendering
Parsing (HTML, XML, CSS, Javascript)
Layout
Text and graphics rendering
Image Decoding
GPU interaction
Network access
Hardware acceleration
Webkit / Blink rendering engine
Image Source: HTML5Rocks
From source to display - The ordinary way
HTML
HTML
Parser
Attachment
CSS ParserStylesheets
Layout
Shared bitmap
DOM tree
CSSOM tree
Render Object
tree
Render Layer
tree
n..1
Layout (Reflow) & Repaint
Layout (reflow):
Parts of the render tree needs to be revalidated and node dimensions should be
recalculated.
Repaint:
Some part of the screen needs to be updated because of a reflow, node geometric
change or style change.
Possible reflows & repaints
• DOM actions (Add, Remove, Update DOM nodes)
• Hide/show with display: none (reflow & repaint)
• Hide/show with visibility: hidden (repaint only because of no geometric change)
• Adding stylesheet dynamically
• scrolling, resizing the window
• DOM queries can cause a reflow too
• offsetTop/Left/Right/Height
• scrollTop/Left/Right/Height
• clientTop/Left/Right/Height
• getComputedStyle
Tips to minimize reflow & repaint
• Try to minimize layout cost with smaller subtree modification
• Detach DOM nodes before huge manipulation
• Do not change styles one by one (use classes instead)
• Group DOM read and write actions to let the browser optimize reflows for you
(DOM queries flush the browser’s queue of changes)
• Cache queried values, do not query them in every case you use it
Compositing, You Are Welcome!
• There are more GraphicContexts
• New tree in our forest, Graphic Layer tree
• Composited RenderLayers get their own backing surface
• Upload painted bitmaps to the GPU as textures
• 256x256 tiles
• Different thread for compositing
• Much cheaper then paint
Frames & Jank
• 60 Hz = We have got 16.66 ms only! ( 60 Hz = 1 / ~0,016)
• 60FPS is important, because 60Hz is average refresh rate of devices
• Jank: every time you can’t create a frame when your screen refreshes
• vSync - generating new frames only between screen refreshes
• JavaScript timers fails because of inaccuracy and different frame rates
• requestAnimationFrame is a good solution
20ms 20ms 20ms 20ms 20ms 20ms 20ms
Display refresh at 60 hz:
Our frame creation:
DEMO! Rock with timeline panel!
Tips:
• Show paint rectangles: Use it to show expensive paints
• Show composited layer borders: Check your GPU compositing layers easily
• Enable continuous page repainting: Easy to find the most expensive layers
• chrome://tracing/: Detailed tracing system to track core functionalities
• Use JavaScript CPU profile with Flame chart to diagnose your yellow pieces.
Memory profiling
Javascript memory basics
Root object
• Top of the memory management system
• We cannot manipulate
• References global variables
Object variable
• Can reference other variables
Scalar variable
• number, boolean, etc
Object sizes
Shallow size
• Memory held directly by the object
• It can be significant for arrays and strings
Retained size
• Indirect memory hold
• A size what will be freed if the object will be terminated
• For primitive types retained size equals shallow size
Object’s retaining tree
Root
A
G
C
D
B
H
D object’s retaining tree is a graph, where paths are retaining paths from GC root to A.
Garbage
Garbage:
Variables wich are unreachable from the GC root node
Garbage collection:
Finds all garbages and frees it’s memory to the system
Leak:
Object that still has retaining path accidently
Possible leaks
• Closures
• Deleting DOM nodes without removing event handlers
• DOM could hold event listeners to objects wich are inactive already
• Cycles: two objects reference to each other when they retain each other
DevTools workflow tips
1. Search for possible memory leaks with timeline panel
2. Use heap snapshots to capture object graph
3. Use all four views of the snapshot panel:
• Summary: An overview of our heap grouped by constructor name
• Comparison: Compare two snapshots
• Containment: Structured view of object graph
• Dominators: Find the most dominant points of the heap
4. Use the new Object Allocation Tracker in DevTools experiments
“Memory Lane with Gmail” talk about this new tool on Google IO 2013
https://developers.google.com/events/io/sessions/325547004
DEMO!
Tips:
• Check counters during your interaction on the examined page
• Use GC force button to see how it impacts on your memory
• Use it in incognito window, because extension allocated memory will be listed too
• Ignore:
• line in parentheses
• lines in light gray
• GC collects garbage before snapshot execution
Use Google Canary as it has all the features I have shown
and more including lots of profiling experiments
https://www.google.com/intl/en/chrome/browser/canary.html
Thank you!
@matenadasdi
Special thanks to Paul Irish and Addy Osmani for reviewing these slides.
Ad

More Related Content

What's hot (12)

Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
Dobrica Pavlinušić
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the Browser
FITC
 
Don't Fear the Platform
Don't Fear the PlatformDon't Fear the Platform
Don't Fear the Platform
ESUG
 
Hypercubes In Hbase
Hypercubes In HbaseHypercubes In Hbase
Hypercubes In Hbase
George Ang
 
NGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.jsNGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.js
davrous
 
Android 12 13_6
Android 12 13_6Android 12 13_6
Android 12 13_6
Sanjiv Gurnani
 
ScalaCache: simple caching in Scala
ScalaCache: simple caching in ScalaScalaCache: simple caching in Scala
ScalaCache: simple caching in Scala
Chris Birchall
 
OpenCms Days 2016: Multilingual websites with OpenCms
OpenCms Days 2016:   Multilingual websites with OpenCmsOpenCms Days 2016:   Multilingual websites with OpenCms
OpenCms Days 2016: Multilingual websites with OpenCms
Alkacon Software GmbH & Co. KG
 
CouchDB Talk JChris NYC
CouchDB Talk JChris NYCCouchDB Talk JChris NYC
CouchDB Talk JChris NYC
Chris Anderson
 
Front End Development Automation with Grunt
Front End Development Automation with GruntFront End Development Automation with Grunt
Front End Development Automation with Grunt
Ladies Who Code
 
Phone Home: A client-side error collection system
Phone Home: A client-side error collection systemPhone Home: A client-side error collection system
Phone Home: A client-side error collection system
Chris Birchall
 
NoSQL solutions
NoSQL solutionsNoSQL solutions
NoSQL solutions
Felix Crisan
 
Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
Dobrica Pavlinušić
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the Browser
FITC
 
Don't Fear the Platform
Don't Fear the PlatformDon't Fear the Platform
Don't Fear the Platform
ESUG
 
Hypercubes In Hbase
Hypercubes In HbaseHypercubes In Hbase
Hypercubes In Hbase
George Ang
 
NGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.jsNGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.js
davrous
 
ScalaCache: simple caching in Scala
ScalaCache: simple caching in ScalaScalaCache: simple caching in Scala
ScalaCache: simple caching in Scala
Chris Birchall
 
CouchDB Talk JChris NYC
CouchDB Talk JChris NYCCouchDB Talk JChris NYC
CouchDB Talk JChris NYC
Chris Anderson
 
Front End Development Automation with Grunt
Front End Development Automation with GruntFront End Development Automation with Grunt
Front End Development Automation with Grunt
Ladies Who Code
 
Phone Home: A client-side error collection system
Phone Home: A client-side error collection systemPhone Home: A client-side error collection system
Phone Home: A client-side error collection system
Chris Birchall
 

Viewers also liked (6)

Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Máté Nádasdi
 
Firefox OS Weekend
Firefox OS WeekendFirefox OS Weekend
Firefox OS Weekend
Máté Nádasdi
 
Optimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 confOptimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 conf
Máté Nádasdi
 
Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stability
Máté Nádasdi
 
Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?
Gareth Hughes
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn
 
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Máté Nádasdi
 
Optimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 confOptimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 conf
Máté Nádasdi
 
Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stability
Máté Nádasdi
 
Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?
Gareth Hughes
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn
 
Ad

Similar to Google Chrome DevTools: Rendering & Memory profiling on Open Academy 2013 (20)

Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
Akihiro Ikezoe
 
Web Tools for GemStone/S
Web Tools for GemStone/SWeb Tools for GemStone/S
Web Tools for GemStone/S
ESUG
 
Forensic Theming - DrupalCon London
Forensic Theming - DrupalCon LondonForensic Theming - DrupalCon London
Forensic Theming - DrupalCon London
Emma Jane Hogbin Westby
 
MongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design PatternsMongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB
 
AEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, IntegrationsAEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, Integrations
connectwebex
 
AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015
Jakub Kaniewski
 
Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android Devices
Irene Duke
 
Machine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville MeetupMachine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville Meetup
Sri Ambati
 
Ruby in office time reboot
Ruby in office time rebootRuby in office time reboot
Ruby in office time reboot
Kentaro Goto
 
Latest Developments in H2O
Latest Developments in H2OLatest Developments in H2O
Latest Developments in H2O
Sri Ambati
 
Webapp Rendering and Optimization.
Webapp Rendering and Optimization.Webapp Rendering and Optimization.
Webapp Rendering and Optimization.
arthurjamain
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph Performance
Chin Huang
 
Javascript for Wep Apps
Javascript for Wep AppsJavascript for Wep Apps
Javascript for Wep Apps
Michael Puckett
 
MongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design PatternsMongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB
 
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
Vladimir Simek
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
Fabian Jakobs
 
Chrome Internals: Paint and Composition
Chrome Internals: Paint and CompositionChrome Internals: Paint and Composition
Chrome Internals: Paint and Composition
Dzmitry Varabei
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design Patterns
MongoDB
 
OpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADOpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CAD
Design World
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
Akihiro Ikezoe
 
Web Tools for GemStone/S
Web Tools for GemStone/SWeb Tools for GemStone/S
Web Tools for GemStone/S
ESUG
 
MongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design PatternsMongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB
 
AEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, IntegrationsAEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, Integrations
connectwebex
 
AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015
Jakub Kaniewski
 
Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android Devices
Irene Duke
 
Machine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville MeetupMachine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville Meetup
Sri Ambati
 
Ruby in office time reboot
Ruby in office time rebootRuby in office time reboot
Ruby in office time reboot
Kentaro Goto
 
Latest Developments in H2O
Latest Developments in H2OLatest Developments in H2O
Latest Developments in H2O
Sri Ambati
 
Webapp Rendering and Optimization.
Webapp Rendering and Optimization.Webapp Rendering and Optimization.
Webapp Rendering and Optimization.
arthurjamain
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph Performance
Chin Huang
 
MongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design PatternsMongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB
 
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
Vladimir Simek
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
Fabian Jakobs
 
Chrome Internals: Paint and Composition
Chrome Internals: Paint and CompositionChrome Internals: Paint and Composition
Chrome Internals: Paint and Composition
Dzmitry Varabei
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design Patterns
MongoDB
 
OpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADOpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CAD
Design World
 
Ad

Recently uploaded (20)

Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Learn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step GuideLearn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step Guide
Marcel David
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Learn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step GuideLearn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step Guide
Marcel David
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 

Google Chrome DevTools: Rendering & Memory profiling on Open Academy 2013

  • 1. Chrome DevTools Rendering & Memory profiling Open Academy 2013 Mate Nadasdi - Ustream, Inc
  • 2. WHY DO WE NEED A DEVTOOL?
  • 3. • Javascript is an interpreted language • HTML, CSS debugging have to happen in the browser • Logging, debugging network requests is essential • Source and the final output could be totally different • Performance optimization is becoming increasingly important, especially on mobile
  • 4. Google is leading in new technologies Native implementation and really fast support Canary build deliver new features in really short intervals Deep configuration possibilites Early experimental access Rendering / Memory Profiling tools Why Google Chrome?
  • 5. Red - Yellow - Blue? Chrome channels • Stable (Releases in every 6 weeks) • Beta (1 month before stable, weekly releases) • Dev (twice weekly) • Canary (daily) Chromium
  • 7. Parsing (HTML, XML, CSS, Javascript) Layout Text and graphics rendering Image Decoding GPU interaction Network access Hardware acceleration Webkit / Blink rendering engine Image Source: HTML5Rocks
  • 8. From source to display - The ordinary way HTML HTML Parser Attachment CSS ParserStylesheets Layout Shared bitmap DOM tree CSSOM tree Render Object tree Render Layer tree n..1
  • 9. Layout (Reflow) & Repaint Layout (reflow): Parts of the render tree needs to be revalidated and node dimensions should be recalculated. Repaint: Some part of the screen needs to be updated because of a reflow, node geometric change or style change.
  • 10. Possible reflows & repaints • DOM actions (Add, Remove, Update DOM nodes) • Hide/show with display: none (reflow & repaint) • Hide/show with visibility: hidden (repaint only because of no geometric change) • Adding stylesheet dynamically • scrolling, resizing the window • DOM queries can cause a reflow too • offsetTop/Left/Right/Height • scrollTop/Left/Right/Height • clientTop/Left/Right/Height • getComputedStyle
  • 11. Tips to minimize reflow & repaint • Try to minimize layout cost with smaller subtree modification • Detach DOM nodes before huge manipulation • Do not change styles one by one (use classes instead) • Group DOM read and write actions to let the browser optimize reflows for you (DOM queries flush the browser’s queue of changes) • Cache queried values, do not query them in every case you use it
  • 12. Compositing, You Are Welcome! • There are more GraphicContexts • New tree in our forest, Graphic Layer tree • Composited RenderLayers get their own backing surface • Upload painted bitmaps to the GPU as textures • 256x256 tiles • Different thread for compositing • Much cheaper then paint
  • 13. Frames & Jank • 60 Hz = We have got 16.66 ms only! ( 60 Hz = 1 / ~0,016) • 60FPS is important, because 60Hz is average refresh rate of devices • Jank: every time you can’t create a frame when your screen refreshes • vSync - generating new frames only between screen refreshes • JavaScript timers fails because of inaccuracy and different frame rates • requestAnimationFrame is a good solution 20ms 20ms 20ms 20ms 20ms 20ms 20ms Display refresh at 60 hz: Our frame creation:
  • 14. DEMO! Rock with timeline panel! Tips: • Show paint rectangles: Use it to show expensive paints • Show composited layer borders: Check your GPU compositing layers easily • Enable continuous page repainting: Easy to find the most expensive layers • chrome://tracing/: Detailed tracing system to track core functionalities • Use JavaScript CPU profile with Flame chart to diagnose your yellow pieces.
  • 16. Javascript memory basics Root object • Top of the memory management system • We cannot manipulate • References global variables Object variable • Can reference other variables Scalar variable • number, boolean, etc
  • 17. Object sizes Shallow size • Memory held directly by the object • It can be significant for arrays and strings Retained size • Indirect memory hold • A size what will be freed if the object will be terminated • For primitive types retained size equals shallow size
  • 18. Object’s retaining tree Root A G C D B H D object’s retaining tree is a graph, where paths are retaining paths from GC root to A.
  • 19. Garbage Garbage: Variables wich are unreachable from the GC root node Garbage collection: Finds all garbages and frees it’s memory to the system Leak: Object that still has retaining path accidently
  • 20. Possible leaks • Closures • Deleting DOM nodes without removing event handlers • DOM could hold event listeners to objects wich are inactive already • Cycles: two objects reference to each other when they retain each other
  • 21. DevTools workflow tips 1. Search for possible memory leaks with timeline panel 2. Use heap snapshots to capture object graph 3. Use all four views of the snapshot panel: • Summary: An overview of our heap grouped by constructor name • Comparison: Compare two snapshots • Containment: Structured view of object graph • Dominators: Find the most dominant points of the heap 4. Use the new Object Allocation Tracker in DevTools experiments “Memory Lane with Gmail” talk about this new tool on Google IO 2013 https://developers.google.com/events/io/sessions/325547004
  • 22. DEMO! Tips: • Check counters during your interaction on the examined page • Use GC force button to see how it impacts on your memory • Use it in incognito window, because extension allocated memory will be listed too • Ignore: • line in parentheses • lines in light gray • GC collects garbage before snapshot execution
  • 23. Use Google Canary as it has all the features I have shown and more including lots of profiling experiments https://www.google.com/intl/en/chrome/browser/canary.html
  • 24. Thank you! @matenadasdi Special thanks to Paul Irish and Addy Osmani for reviewing these slides.